HTML:
<mat-selection-list #selectedColumns [(ngModel)] ="selectedOptions">
<div class= "content-section">
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title> Account<mat-panel-title>
<mat-expansion-panel-header>
<mat-list-option class= "download-columns"
checkboxPosition="before"
*ngFor= "let column of singleNodeColumns"
[selected]="column.template.Mandatory"
[disabled]="column.template.Mandatory"
[value]="column.template">
<div class= "down load-columns-text">
<span> {{column.template.Name}}</span>
TS:
DeSelectionAll()
{ this.selectedColumns.selectedOption.clear(); }
This will deselect all checkboxes but it also deselects the column.template.Mandatory
which I do not want. Please Help.
I don't see the component.ts file, so not sure what your
selectedOptions
andcolumn.template.Mandatory
look like. My best guess is, you have to run a filter, to remove all items, except the ones that match with mandatory items.Something like:
If
column.template.Mandatory
is an array, than you have looks for the match with thecolumn.template.Mandatory
array:If
selectedOptions
andcolumn.template.Mandatory
have identifier fields like 'id', you can run above function withx.id === item.id