Is it possible to set select option disabled
, if the value is j = 0
?
The j value is taken from a DB.
JavaScript
x
8
1
<ng-container *ngFor="let interventi of variabileIntervento; index as i">
2
<tr *ngFor="let variante of interventi.varianti; index as j">
3
<td><select [(ngModel)]="type" (change)="changeTotal()">
4
<option selected disabled>Select</option>
5
<option value="0">{{interventi.supIntonacate[j]}}</option>
6
<option value="1">{{interventi.supEvIi[j]}}</option>
7
<option value="2">{{interventi.supIvEi[j]}}</option></select></td>
8
Advertisement
Answer
Try this:
JavaScript
1
2
1
<option selected [disabled]="j === 0 ? true : false">Select</option>
2
or this, if not work:
JavaScript
1
2
1
<option selected [attr.disabled]="j === 0 ? 'disabled' : null">Select<option>
2
Source: https://angular.io/guide/binding-syntax#property-and-attribute-comparison