Skip to content

mahrmediait/angular-mousetrap

 
 

Repository files navigation

Angular Moustrap

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

Forked from ngx-mousetrap: https://github.com/nagarsuresh/ngx-mousetrap-angular

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

About

Angular library to use mousetrap as Angular Service or Directive

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 80.8%
  • JavaScript 12.2%
  • HTML 6.1%
  • SCSS 0.9%