-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngModel bound dropdown value changes visually while variable doesn't #7736
Comments
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? |
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. |
This is fixed by #10639 - see http://plnkr.co/edit/xySkDHjCmr3U56SRhbIm?p=preview |
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/
The text was updated successfully, but these errors were encountered: