alvardo
alvardo

Reputation: 157

Ionic 2 Dinamic Select, all options selected automatically

I am using Ionic 2, I have created a select populated with firebase:

        <ion-select formControlName="potentialPet">
        <ion-option *ngFor="let potentialPet of potentialPets | async"
               value="potentialPet.name">{{potentialPet.name}}</ion-option>

    </ion-select>

On selection I choose one option choosing one option, but then all are selected.options

It seems like a problem related to the ion option value.

Upvotes: 1

Views: 494

Answers (1)

mohamad rabee
mohamad rabee

Reputation: 587

the value should be binding, so change to

<ion-select formControlName="potentialPet">
        <ion-option *ngFor="let potentialPet of potentialPets | async"
               [value]="potentialPet.name">{{potentialPet.name}}</ion-option>

    </ion-select>

Upvotes: 3

Related Questions