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>
CodePudding user response:
You can use fieldset
HTML element to group several controls.
<fieldset [disabled]="isLoading">
<button mat-button>X</button>
<button mat-button>Y</button>
<button mat-button>Z</button>
</fieldset>