I am getting string like this, 55,118,122,126,116,58,125,119,132 from API. These are the ids. I have a angular mat-selection-list. I want to initially select these value. So, basically i want to update existing data and send it to again.
this is my Mat selection list.
<mat-selection-list #yuvakslist [(ngModel)]="preselectedOptions"
(selectionChange)="onChangeYuvak()">
<mat-list-option *ngFor="let yuvak of yuvaks" class="mt-1" [value]="yuvak.user_id">
<nb-user name="{{yuvak.cnt_first_name + ' ' +
yuvak.cnt_last_name}}" size="large" title="{{yuvak.cnt_mobile_no}}"
picture="{{thumbnailImg}}{{yuvak.profile_picture}}">
</nb-user>
</mat-list-option>
</mat-selection-list>
i tried assigning all the ids i receive from API to array like this.
const preselectedOptions: Number[] = data.data.present_contact;
i want to pre-select those values onto mat-selection-list. So, i can update form.