Rafael de Castro
Rafael de Castro

Reputation: 1098

On IONIC Ion-Select is 'selecting' all options on choice

On my Ionic app, I have a ion-select:

<ion-item>
  <ion-label>Type</ion-label>

  <ion-select [(ngModel)]="type" interface="action-sheet">
      <ion-option *ngFor="let type of types" 
                  value="type.class">
                  {{type.name}}
      </ion-option>
  </ion-select>
</ion-item>

And everytime I choose an option it selects all options avaiable. I alredy try to use the attribute multiple="false" but didn't worked.

Extra details:

type.class is the same value for every option. I already put diferent values for each option. None worked. If I totally remove the value="" it work properly

Any help?

Upvotes: 3

Views: 3933

Answers (1)

amal
amal

Reputation: 3170

Since your value assignments are dynamic, you need to use [] around the value like,

<ion-option *ngFor="let type of types" [value]="type.class">
  {{type.name}}
</ion-option>

Hope it helps.

Upvotes: 12

Related Questions