How to prevent an a element's click event what bind by angular?



I have an a element like this

<a class='btn' ng-click="alert('clicked')"></a>

in js


I had tested use ng-disabled but dose not work.
this is my html
this is my html
this is my directive
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?


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']) {

Answered By – Potato Running

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More