Home > Net >  When i select an option for a dropdown list,this affectes all the other dropdown lists value
When i select an option for a dropdown list,this affectes all the other dropdown lists value

Time:08-24

Problem

Here is my dropdown lists for rows.And these dropdown lists created with ngFor.When i select an option for any dropdown list, the selected value of all dropdowns change.Can anyone help me for this.

Codes

And this is my code.

CodePudding user response:

I am going to assume, given that this is just images instead of posted html/ts code, that the issue lies in your ngModel for the select option. You are using the same model for all of them, thus any change would of course be reflected throughout all of the elements that use that model.

What you need to do is define a model for each one of those dropdown

CodePudding user response:

your ngModel selectedStudent is the same for all the dropdowns. If the value changes, it will impact all the dropdowns

  • Related