Issue
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">
{{surety.SuretyName}}
</mat-list-option>
</mat-selection-list>
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
Solution
try mat-list-option
selected
input.
<mat-list-option [selected]="condition">....
Answered By - tmsbrndz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.