Created
May 8, 2014 10:48
-
-
Save tmoitie/0c351161ef34a6b7380d to your computer and use it in GitHub Desktop.
This file contains 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
angular.module('app').directive('closeEsc', ['$window', function($window){ | |
return { | |
restrict: 'A', | |
link: function (scope, element, attrs) { | |
angular.element($window).bind('keyup', function(event){ | |
if (event.keyCode === 27) { | |
scope[attrs.closeEsc] = false; | |
scope.$apply(); | |
} | |
}); | |
} | |
}; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment