Issue
I have an a element like this
<a class='btn' ng-click="alert('clicked')"></a>
in js
$scope.alert=(item)=>{alert(item)};
I had tested use ng-disabled but dose not work.
this is my html
this is my directive
I have many a element in my project so I want to write a directive like ng-disable how to write it?
Solution
I think this is the way to solve the problem,thank you for all of you to help me solve the problem~
.directive('a', function() {
return {
restrict: "E",
replace: true,
scope: {
},
link: function(scope, elem, attr) {
if (attr['ngDisabled']) {
elem.unbind('click');
}
}
}
});
Answered By - Potato Running
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.