Reputation: 185
I have an Angular component that contains a select element. In some cases I want the "multiple" attribute to be added to the element. Is there a way to add it conditionally?
Upvotes: 1
Views: 707
Reputation: 1323
For a select, conditionally enable the multiple as shown:
<md-select [formControl]="myForm" [multiple]="multiEnabled">
Your condition to enable or disable the attribute:
multiEnabled = false;
The above is for a Material select control.
Haven't tried it on other controls.
Upvotes: 1