Skip to content

Instantly share code, notes, and snippets.

@vprimachenko
Created September 10, 2013 01:07
Show Gist options
  • Save vprimachenko/6503737 to your computer and use it in GitHub Desktop.
Save vprimachenko/6503737 to your computer and use it in GitHub Desktop.
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