[Fixed] Angular/material ui – programatically select mat-selection-list


I have a mat-selection-list that I need to programmatically check specific items when the component loads. The items I need to check will be selected based on the [value] of the mat-list-option. I can’t find any documentation on this. The html is pretty simple:

<mat-selection-list color="primary" #suretyList formControlName="AgentAgencyAndSureties">
    <mat-list-option *ngFor="let surety of suretyNames" [value]="surety.Id">

I just want to check items with a specific surety.Id in the value. It doesn’t seem like this should be too hard to do but like I said, I can’t find any examples or good documentation on this.

I am using Angular 10 for both the core and material UI


try mat-list-option selected input.

<mat-list-option  [selected]="condition">....

Leave a Reply

(*) Required, Your email will not be published