Created
May 22, 2013 04:00
-
-
Save clouddueling/5625160 to your computer and use it in GitHub Desktop.
listens for keypress enter only. great for textareas when you don't need ALL of angular-ui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directives.directive('ngEnter', function(){ | |
return { | |
restrict: 'A', | |
link: function(scope, elem, attr, ctrl) { | |
elem.bind('keypress', function(e, ui){ | |
if (e.keyCode == '13') { | |
scope.$apply(function(s) { | |
s.$eval(attr.ngEnter); | |
}); | |
} | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment