1

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] Commented Aug 9, 2017 at 6:02
  • Thanks alot..it worked out :) Commented Aug 9, 2017 at 6:28

2 Answers 2

0

@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

Sign up to request clarification or add additional context in comments.

Comments

0

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

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.