I have a dropdown. I want to disable the entire mat-select when the selected value is Uber. Otherwise, it needs to be enabled.
<mat-label>DB Property Name</mat-label>
<mat-select class="dBProperty" name="dbpropertyName{{i}}" [(ngModel)]="mappingObj.dbpropertyName" [disabled]="selectedValue=='**Uber**'?'disabled':'null'" required>
<mat-option *ngFor="let options of dBPropertyArray" [value]="options.dBProperty" >{{options.dBProperty}}
</mat-option>
</mat-select>
How can I achieve it ..? This is my code. where am I going wrong?
use disabled attribute for that.
<mat-select
class="dBProperty"
name="dbpropertyName{{i}}"
[(ngModel)]="mappingObj.dbpropertyName"
[disabled]="mappingObj.dbpropertyName=='Uber'"
required>
<mat-option *ngFor="let options of dBPropertyArray" [value]="options.dBProperty">{{options.dBProperty}}
</mat-option>
</mat-select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With