.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if (event.which === 13) {
scope.$apply(function() {
scope.$eval(attrs.ngEnter, {
'event' : event
});
});
event.preventDefault();
}
});
};
});
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Showing posts with label directive. Show all posts
Showing posts with label directive. Show all posts
Friday, July 4, 2014
Angular ng-enter Directive
Just copied it from somewhere to keep for myself .. I mostly put it in the app.js at the bottom so everyone is able to use this function.
Subscribe to:
Posts (Atom)