I am interested in creating an attribute directive that adds an icon to a button when it is disabled.
Click here to see a similar example on Fiddle
In addition, I would like to include the ng-disabled
directive during the compile
process (with the value of disabled-button
).
What is the most effective approach for this?
When I tried adding the ng-disabled
attribute in the compile function, it did not compile. Therefore, if I re-compile my element in the link
function, I encounter errors such as having to remove the ng-tranclude
directive and triggering events like ng-click
twice.
Bonus question: Can I restrict my attribute directive to only apply to html elements like <a>
or <button>
?
Thank you.