Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230189

Ion-select does not show selected option when value is an object type

$
0
0

Hello @pratikpdw ,
Please try with ngModel. I tried on Ionic 5 it works.
TS Code:

export class Tab2Page {
  test = {
    selected:"{key:'abc',value:'ABC'}"
  };
  constructor() {}
}

HTML

<ion-item>
        <ion-label>Choose</ion-label>
        <ion-select [(ngModel)]="test.selected">
            <ion-select-option value="{key:'abc',value:'ABC'}" >ABC</ion-select-option>
            <ion-select-option value="{key:'pqr',value:'PQR'}">PQR</ion-select-option>
            <ion-select-option value="{key:'xyz',value:'XYZ'}">XYZ</ion-select-option>
        </ion-select>
    </ion-item>

Viewing all articles
Browse latest Browse all 230189

Trending Articles