kirstein / angular-autodisable

ngAutodisable directive for angular. Automatic disable for buttons rocks!
http://jsfiddle.net/kirstein/wXnks/embedded/result/
MIT License
63 stars 26 forks source link

'disabled' attribute is ineffective on an 'a' element #12

Closed MichaelDiguet closed 9 years ago

MichaelDiguet commented 9 years ago

Hello, First, thank you very much for this great module. I use it in my new project and it is very useful and convenient. I think the following pattern is commonly used :

<a href="" ng-click="myFunction()">Myfunction</a>

With angular-autodisable, it would be useful to write that:

<a href="" ng-click="myFunction()" ng-autodisable>Myfunction</a>

Unfortunately, it does not work, since the disabled attribute does not forbid the ng-click to occur. I made a fix for my project: I get the element to disable as a parameter of triggerHandler and I immediatly return in triggerHandler if this element has the disabled attribute.

mburgosh commented 9 years ago

There is no disabled attribute for hyperlinks. ng-autodisable will work on any element and add a disabled attribute, but this will have no effect on a tags. Try using ng-autodisable-class and use this css class:

http://stackoverflow.com/questions/2091168/disable-a-link-using-css