-
Notifications
You must be signed in to change notification settings - Fork 27.6k
selected select option not updating when model change #10939
Comments
Without a reproduction, there's very littel we can do about this. Also, which version of angular are you using? |
Here's a basic plunker showing the issue: http://plnkr.co/edit/U0N3VzU1CCb5LZuevBX3?p=preview In the plunker, only the first selected option is correct. It very clearly shows a disconnect between the model and the view, despite a digest cycle having run. All other information is in my edited initial post. |
There is a big refactoring of ng-options in 1.4, I was curious to try 1.4.0-beta.2 in the plunker. |
With a title like this, you are only so very slightly increasing your chances that somebody looks at this. Please understand that this is an open source project and our time is limited. This seems like a valid issue, though. |
Well, actually, the documentation for select notes specifically that ngOptions instead of repeated option elements should be used when the model is bound to a non-string value (like in your case, value is an integer). |
Wow. I found the problem. The data coming off of the server for the options is a string, but the value is a number. I needed to format the option values as numbers. That and using ng-options (as in the now-working plunker) fixed the issue. ng-options did fix the issue. In my app and in the production code. |
i have the code in my angularjs - ionic project but on iOS9 upon clicking on selecting from the dropdownlist , it doesn't bind to the model unless the user clicks somewhere else. Statewht is wrong wt the code why wouldn't it bind to the model when selected. This happens only on ios9. |
Plunker: http://plnkr.co/edit/U0N3VzU1CCb5LZuevBX3?p=preview
Version: 1.3.0-beta.18
The basics are:
3 selects
select 1 is the parent of select 2
select 2 is the parent of select 3
select 1 -> select 2 -> select 3
when select 1's value changes, the options for select 2 change, and are fetched asynchronously.
when select 2's value changes, the options for select 3 change, and are fetched asynchronously.
these asynchronous updates are accomplished using several $watch()es.
$watch("select 1", function(n){
[select 2].getOptions(n);
});
$watch("select 2", function(n){
[select 3].getOptions(n);
});
all the selects have values before their options change
the options for each select look like this:
[{k: 0, v : 'a'},
{k: 2, v: 'c'},
{k: 3, v: 'b'},
... etc.]
select 1's displayed option is correct
select 2's, 3's, 4's, etc. displayed option is NOT correct (it just displays the first option in the list)
the model value matches one of the option values, however that option is not displayed.
The text was updated successfully, but these errors were encountered: