Provide hotkey functionality in AngularJS
- User Bower install hotkey.
bower install ng-hotkey
- Include hotkey on your page
<script src="/path/to/hotkey.min.js"></script>
- Put nghotkey to your module dependencies
var app = angular.module('app', ['hotkey']);
- Set hotkey for elements or directives using hotkey directive as an attribute
<input type="text" hotkey="ctrl+I"></input>
<input type="text" hotkey="F2"></input>
<textarea hotkey="ctrl+shift+v"></textarea>
<button hotkey="CTRL+M Meta+M" ng-click="run()">run</button>
<input type="text" enter="func()" focus></input>
If have ng-click attribute then execution ng-click else focus.