Ion-select with list of objects


I have a list of objects. e.g.

myList = [
{id: 'some-id-1',
name:'Some name 1'},
{id: 'some-id-2',
name:'Some name 2'}

Then I’m using a to select one of the options like this:

<ion-select [(ngModel)]="selectedListItem">
        <ion-option *ngFor="#item of myList" [value]="item" >{{}}</ion-option>

Everything works fine. Setting and saving it all - works like a charm.

Then when i re-enter the same page, to change my selection, my shows as if no value is selected. I am 100% sure that the selectedListItem variable is set, and that it is an object, just like the ones in the list. But it does not show up as selected.

I’m not sure if I’m able to explain the problem 100% here. Hopefully I am, and hopefully someone can point me into the right direction to get this sorted.

Thanks in advance :slight_smile:

I have the same problem.  I used trackBy but it didn't helped. 

`   <ion-select [(ngModel)]="selectedListItem">
        <ion-option *ngFor="let item of myList; trackBy:trackByItems" [value]="item"    {{}}</ion-option>

// in typescript code
trackByItems(index: number, item: any) { return; } `

Hi Guys,

I am having this same issue with ionicV5-vue . I would like to know how to solve it ?