Reputation: 1734
I'm currently using Angular UI to add a hotkey to an element, but it doesn't seem to support multiple hotkeys. What would be the best way to get this working?
Upvotes: 0
Views: 415
Reputation: 35846
Not using Angular-UI, but you maybe you could have a look to the angular-hotkeys directive, it allow you to bind one or more keys to an event function.
Example
<div hotkey="{ 'A': functionA, 'B': functionB }"></div>
$scope.functionA = function (event) {
event.preventDefault();
console.log('A key pressed.');
}
$scope.functionB = function (event) {
event.preventDefault();
console.log('B key pressed.');
}
Upvotes: 1