I am trying to dynamically enable/disable a set of select inputs, based on the value of another select (true/false). However, it seems to only work on initial page load.
The form loads with the select inputs disabled. When I change the controlling input to true
, the other inputs are now enabled.
However, they do not change back after that initial enable.
My code is as follows:
<tr *ngFor="let prod of seg.products">
<td>{{prod.name}}</td>
<td>
<!-- The controlling selector -->
<select [(ngModel)]="prod.isAffected" name="{{prod.name + 'AffectedSelector'}}">
<option [value]="false" select>No</option>
<option [value]="true">Yes</option>
</select>
</td>
<!-- These load as disabled and can be changed only once -->
<td *ngFor="let plat of platformList;let j=index">
<select name="{{prod.name + 'NASelector' + j}}" [disabled]="prod.isAffected">
<option value="false" selected>No</option>
<option value="true">Yes</option>
</select>
</td>
</tr>
In the component, I have tried initializing the isAffected
value as both false
and null
with the exact same resultes.
I have also tried using prod.isAffected ? true : null (and false)
.
I have also tried to just use [ngClass]={'disabled' : prod.isAffected}
.
Am I missing something?