I am using ion-select-multiple
. It works perfectly fine normally. I have a requirement to pre select few options in it. I searched the web and found the solution, but after pre assigning the values, now when I try to change, it gives me error.
Here is my home.html
code:
<ion-select multiple="true" okText="Okay" cancelText="Dismiss" [(ngModel)]="followers" [value]="{$value: followers}">
<ion-select-option value="brown">Brown</ion-select-option>
<ion-select-option value="blonde">Blonde</ion-select-option>
<ion-select-option value="black">Black</ion-select-option>
</ion-select>
home.ts
followers = ['brown','black'];
Please note, Brown
and Black
are pre selected, but if I try to select/de-select anything from list, it gives error -
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'model: 12w 3'. Current value: 'model: [object Object]'.
This error goes away if I remove this code: [value]="{$value: followers}"
.
How do I manage this error?
Add error screenshot: