You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 17, 2022. It is now read-only.
Antonio M S S Jr edited this page Mar 2, 2017
·
1 revision
How to prevent a ng-click event when <a> tag is disabled?
i wrote the following code, update to your needs.:
.directive('ngClick',function(){return{restrict: 'A',priority: 1,terminal: true,// this will prevent default ng-click behaviourlink: function(scope,element,attr){varclickAction=attr.ngClick;// get the current ngclick valuevarbinding=element.bind('click',function(){if(attr.disabled==undefined){//check if the tag is available to be clickedscope.$eval(clickAction)// call the event}});scope.$on('$destroy',function(){binding();// destroy the bind we created, preventing a memory leak.})}};});