0
<a  md-icon-button [routerLink]="['./new']" queryParamsHandling="merge"
                mdTooltip="Add Document" [disabled]="isAddButtonDisabled(selectedAssociation)">
                <md-icon>add</md-icon>
            </a>

The button is firing click event even when the button is disabled. Is there a way to prevent the click?

Volleyball Player
  • 331
  • 1
  • 6
  • 13
  • Possible duplicate of [How to disable HTML links](https://stackoverflow.com/questions/10276133/how-to-disable-html-links) – Igor Nov 08 '18 at 02:33
  • hope this will help https://stackoverflow.com/questions/36985112/angular2-what-is-the-correct-way-to-disable-an-anchor-element – Geek Nov 08 '18 at 03:10

2 Answers2

1

You cannot disable the achor tag - try to hide the anchor tag by wrapping it inside a div or use css to disable the anchor tag

Whereas [disabled] is a property binding it can hold only a property value - you are trying to bind a function to it - I'm not sure this will work - please check

Happy coding !!

Rahul
  • 2,040
  • 2
  • 11
  • 29
-2

Try this CSS rule:

[disabled]{
  pointer-events: none;
}
Anzor Asadov
  • 274
  • 2
  • 13