Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngModel bound dropdown value changes visually while variable doesn't #7736

Closed
alfoudari opened this issue Jun 6, 2014 · 3 comments
Closed

Comments

@alfoudari
Copy link

By binding a dropdown to a variable, it would make sense for that variable to hold the selected option of the dropdown at all times. However, this is not the case. If you select an item in a dropdown, then refresh the list of items (via a variable in ng-options), if the selected item is not included in the new list it reverts back to the default option (visually) while ngModel bound variable holds the old selected value.

Here is a fiddle: http://jsfiddle.net/LUm7y/

@jeffbcross
Copy link
Contributor

Hi @abstractpaper, I'm not able to see the behavior describing on Chrome on Mac OSX. If I select the country, I see the model change. Then if I select the default option, I see the model change back to the expected value. Maybe I'm looking at it wrong?

Also, could you see if your issue still exists in Angular 1.2.19?

@alfoudari
Copy link
Author

Hi @jeffbcross, the scenario is as follows: change country dropdown to one of the countries, then change the first dropdown to "opt1" option (which will change the list of countries available), you would notice that filter.country is still holding the old value it had while countries dropdown resets to "All Countries".

I have tested it against 1.2.19 on Chrome on both Ubuntu and Windows, behavior remains the same.

@Narretz Narretz added this to the Backlog milestone Jul 16, 2014
@btford btford removed the gh: issue label Aug 20, 2014
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2015
@petebacondarwin
Copy link
Contributor

This is fixed by #10639 - see http://plnkr.co/edit/xySkDHjCmr3U56SRhbIm?p=preview

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants