Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ng-enter="myFunction()"
- app.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.preventDefault();
- }
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement