Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
accessible ng-click
angular.module('atac.common').directive('azAction', function azActionDirective() {
'use strict';
return {
restrict: 'A',
link: function(scope, el, attrs) {
el.attr('tabindex', 0);
el.on('click', action);
el.on('keyup', function(event) {
if (event.which === 32 || event.which === 13) {
action();
}
});
function action() {
scope.$eval(attrs.azAction);
scope.$safeApply();
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.