How to display SELECTED value in ion-option


#1

I have a generic ion-option, but I want to display the value was selected from the list.
Before Ionic 2 RC, the CHECKED is able fulfill my requirement, but now it will return error.

My code before 2 RC

<ion-select [(ngModel)]="testvalue">
      <ion-option *ngFor="let item of yesNo" [value]="item.code"
      [checked]="(item.code == testvalue)">{{item.name}}</ion-option>
 </ion-select>

Anybody can advise?


#2

I have the same problem, did you find a solution.


#3

Have you find a solution? It’s not working for me, either:

<ion-select [(ngModel)]="company.form">
     <ion-option *ngFor="let form of forms" [value]="form" [selected]="true">{{form.name}}</ion-option>
</ion-select>

Constant true value in selected attribute was my last hope. I thought it will set the last option as selected but doens’t work even this way. Would be nice to have an example in the docs.