ngx-mousetrap
TypeScript icon, indicating that this package has built-in type declarations

13.0.0 • Public • Published

NgxMousetrap

An Angular library to use mousetrap as Angular service or Angular Directive.

Getting Started

Using as Directive

<button class="btn btn-primary"
  (click)="onClick()"
  [ngxMousetrapKey]="'command+enter | ctrl+enter'">
    Click or press (command/ctrl)+enter
</button>

When the keyboard shortcut is pressed, button will get clicked!

Using as Angular Service

    const saveKey = 'command+s | ctrl+s'
    this.subscription = this.ngxMousetrapService.register(saveKey).
      subscribe(evt => {
        <!-- save hotkey pressed -->
      });

Demo

https://nagarsuresh.github.io/ngx-mousetrap-angular/

NPM

https://www.npmjs.com/package/ngx-mousetrap

Readme

Keywords

Package Sidebar

Install

npm i ngx-mousetrap

Weekly Downloads

9

Version

13.0.0

License

none

Unpacked Size

67 kB

Total Files

24

Last publish

Collaborators

  • nagarsuresh