Create a gist now

Instantly share code, notes, and snippets.

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