'Angular | How to add condition to multiple elements by writing once
I have a div with multiple buttons in it... All buttons work similarly and I would like to disable all the buttons when a condition is true.
Currently the way I do it is..
<button mat-button [disabled]="isLoading"> X </button>
<button mat-button [disabled]="isLoading"> Y </button>
<button mat-button [disabled]="isLoading"> Z </button>
Is there a way where I would have to type [disabled]="isLoading" only once.
Something like this (Doesn't Work)
<ng-container [disabled]="isLoading">
<button mat-button>X</button>
<button mat-button>Y</button>
<button mat-button>Z</button>
</ng-container>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
