Author: | milestechnologies |
---|---|
Official Page: | Go to website |
Publish Date: | November 13, 2019 |
License: | MIT |
Description:
A simple Angular directive/component to create custom keyboard shortcuts (hotkeys) on your Angular based applications.
How to use it:
1. Install the package.
# NPM $ npm install ngx-keyboard-shortcuts --save
2. Import the module.
import { NgxKeyboardShortcutModule } from 'ngx-keyboard-shortcuts'; @NgModule({ imports: [NgxKeyboardShortcutModule.forRoot()] }) export class AppModule {}
3. The example to create a shortcut (Ctrl+s).
<button [keyboardShortcut]="keyboardShortcutDef" (click)="example()"> Click Me </button> keyboardShortcutDef: IKeyboardShortcutListenerOptions = { description: 'example', keyBinding: [KeyboardKeys.Ctrl, KeyboardKeys.Shift, 'i'] };