Guest User

Untitled

a guest
Dec 15th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. directive('enterPress', function () {
  2.     return function (scope, element, attrs) {
  3.       element.bind("keydown keypress", function (event) {
  4.         if(event.which === 13) {
  5.           scope.$apply(function (){
  6.             scope.$eval(attrs.enterPress);
  7.           });
  8.  
  9.           event.preventDefault();
  10.         }
  11.       });
  12.     };
  13.   });
Advertisement
Add Comment
Please, Sign In to add comment