angular2-hotkeys icon indicating copy to clipboard operation
angular2-hotkeys copied to clipboard

How to use function keys?

Open lunanigra opened this issue 5 years ago • 1 comments

Hello, does your Hotkeys service also support function keys or control keys (e.g. F1, F2, ..., F8)?

Would be cool if you can add an example to your documentation.

Thanks!

lunanigra avatar Dec 05 '19 12:12 lunanigra

@lunanigra yes Hotkeys service works perfectly for function keys and control keys.

 this._hotkeysService.add(new Hotkey(
      ['f1',"f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11" ,"f12", "ctrl" ] ,(event: KeyboardEvent): boolean => {
      console.log('Typed hotkey',event );
      return false; // Prevent bubbling
  }));

you have to give lowercase in the hotKey parameter string for all keycode. This works fine form me. I hope it will be help full for you.

vishalisakar avatar Nov 24 '20 13:11 vishalisakar