Created
September 10, 2013 01:07
-
-
Save vprimachenko/6503737 to your computer and use it in GitHub Desktop.
angular.js keyevents for everywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.directive('onKeydown', ['$parse',function($parse) { | |
return function(scope, elm, attrs) { | |
var keydownFn = $parse(attrs.onKeydown); | |
elm.bind("keydown", function(event) { | |
scope.$apply(function(){ | |
keydownFn(scope, { '$event': event }); | |
}); | |
}); | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment