1
votes

I'm learning coding in ionic2 framework with angularJs2. While using ion-select in ngFor(similar to ng-repeat) in ion-list I'm facing issue. If i change single list item dropdown value then whole list value gets changed. Html Page and output screen.

When I select "1"from dropdown then whole list value gets changed. How can I change only the particular list item index dropdown so that it wont affect other.

Can anyone help me regarding this?

2
change you ng-model to selectedvalue[i]Gaurav Srivastava
Thanks alot..it worked out :)Nadhinidevi Balakrishnan.G

2 Answers

0
votes

@nadhinidevi

You want to pass ngModel value dynamically and different. In your case you have passed same value for all option so when you change select option value at time change all option value.

Refer following code

<ion-item>
  <ion-select [(ngModel)]="i" interface="popover" (change)="onChange(i)">
    <ion-option value="select">Select</ion-option>
    <ion-option value="1">1</ion-option>
    <ion-option value="2">2</ion-option>
  </ion-select>
</ion-item>

I hope its work for you

0
votes

All the list dropdown is changing becuase all have the same model. Change your ng-model to:

[(ng-model)]="selectedvalue[i]"