Skip to content

Instantly share code, notes, and snippets.

@vprimachenko
Created September 10, 2013 01:07
Embed
What would you like to do?
angular.js keyevents for everywhere
.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