Skip to content

Instantly share code, notes, and snippets.

@ojacquemart
Created February 28, 2014 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojacquemart/9280350 to your computer and use it in GitHub Desktop.
Save ojacquemart/9280350 to your computer and use it in GitHub Desktop.
BodyBindKeydown
.directive('bindKeydown', function () {
return {
restrict: 'A',
link: function (scope, element) {
element.bind('keydown', function (e) {
if (e.target === element[0]) {
scope.$broadcast('body:keydown', e.keyCode);
}
});
}
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment