Skip to content

Instantly share code, notes, and snippets.

@anri-asaturov
Last active April 7, 2017 07:53
Show Gist options
  • Save anri-asaturov/10208667 to your computer and use it in GitHub Desktop.
Save anri-asaturov/10208667 to your computer and use it in GitHub Desktop.
Angular blur on enter directive
myApp.directive('blurOnEnter', function(){
return {
link: function (scope, element, attrs) {
element.bind("keypress", function (event) {
if(event.which === 13) {
element.blur();
event.preventDefault();
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment