I have the following piece of code of ion-select
<ion-select
placeholder="Select Device"
interface="popover"
[compareWith]="compareFn"
(ionChange)="selectedDevice($event)"
>
<ion-select-option value="0" selected>All</ion-select-option>
<ion-select-option
*ngFor="let device of Devices"
value="{{device.id}}"
>
{{device.name}}
</ion-select-option>
</ion-select>
And the compare function as follows;
compareFn(e1, e2): boolean {
return e1 && e2 ? e1.deviceId == e2.deviceId : e1 == e2;
}
Now, this selection is in my home page, once I select a device selectedDevice
will execute fine and goes to the details page.
Now when I click the back button and comes to the home page, I can see that all devices are shown, and when I try to select the last pre-selected option, I am not able to execute the selectedDevice
function?
But if I change my option to another one, then the function executes perfectly.
What am I doing wrong?
Please help me.