Provide hotkey functionality in AngularJS using Mousetrap
- Include nghotkey on your page
<script src="/path/to/mousetrap.min.js"></script>
<script src="/path/to/nghotkey.js"></script>
- Put nghotkey to your module dependencies
var app = angular.module('app', ['nghotkey']);
- Set hotkey for elements or directives using hotkey directive as an attribute
<input type="text" hotkey="h ?" hotkey-action="keyup" />
<input type="button" hotkey="ctrl+;"/>