Created
June 23, 2015 13:17
Revisions
-
snapwich created this gist
Jun 23, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ // keyboard and accessibility directive .directive("ngClick", function() { var KEY_ENTER = 13, KEY_SPACE = 32; return { restrict: "A", link: function(scope, elem, attrs) { elem.css({ cursor: "pointer" }); elem.on("keyup", function(e) { switch(e.which) { case KEY_ENTER: case KEY_SPACE: scope.$apply(function() { scope.$eval(attrs.ngClick); }); break; } }) } }; });