I have the following mat-selection-list. I need it to enable the options in a cascading fashion. i.e. The Second Selection will not be enabled until the First Selection is selected. The Third Selection will not be enabled until the Second Selection is select, etc...
Here is the html code for the list:
<mat-selection-list id='selectedParameters' [(ngModel)]="selectedCriteria">
<mat-list-option *ngFor="let item of incomingParameters" [selected]="item.selected" [value]="item.name"
[disabled]="item.disabled" checkboxPosition="before" (click)="GetChange(item)">
{{item.name}}
</mat-list-option>
</mat-selection-list>
Here is how I populate the List:
if (this.data.criteria.FirstSelection) {
arr.push({
name: 'First Selection',
selected: false,
disabled: 'false',
});
}
if (this.data.criteria.SecondSelection) {
arr.push({
name: 'Second Selection',
selected: false,
disabled: 'true',
});
}
if (this.data.criteria.ThirdSelection) {
arr.push({
name: 'Third Selection',
selected: false,
disabled: 'true',
});
}
if (this.data.criteria.FourthSelection) {
arr.push({
name: 'Fourth Selection',
selected: false,
disabled: 'true',
});
}
if (this.data.criteria.FifthSelection) {
arr.push({
name: 'Fifth Selection',
selected: false,
disabled: 'true',
});
}
if (this.data.criteria.Sixth Selection) {
arr.push({
name: 'Sixth Selection',
selected: false,
disabled: 'true',
});
}
How can I cascade the enabling/disabling of the options?