You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Select - when ngModel is set before options, nothing gets selected #13274
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When ngModel is asynchronously loaded before options, nothing gets selected.
Expected behavior
It should not matter if ngModel or options is loaded first.
is workaround to get same instances of object.
First call getCountries returns list of all available options. getSelectedCountries returns list of selected countries. But with different objects.
So I get ids of selected objects. Then I also get IDs of all objects (currentIds) and I find out indices of items which should be selected. Then I map those indices into objects.
I saved my updates but for some reason they were not visible. I tried to freeze/unfreeze several times and now it should be visible. (I tested it in browser anonymous mode).
Activity
vicb commentedon Dec 6, 2016
Please add steps to reproduce with your plunker (ie what do you see vs what you expect to see)
klinki commentedon Dec 6, 2016
Right. Sorry I forgot to publish latest changes in plunker.
Now in example there are 2 selects:
I expect to see the same results for both - value being correctly selected in select.
DzmitryShylovich commentedon Dec 6, 2016
I still not fully understand what the issues is.
but I just added setTimeout and they both work identically so there's no issue with loading order.
klinki commentedon Dec 6, 2016
Interesting, I see this:
http://prnt.sc/dg8bly
DzmitryShylovich commentedon Dec 6, 2016
did u save updates in your plunker?
klinki commentedon Dec 6, 2016
This
is workaround to get same instances of object.
First call
getCountriesreturns list of all available options.getSelectedCountriesreturns list of selected countries. But with different objects.So I get ids of selected objects. Then I also get IDs of all objects (currentIds) and I find out indices of items which should be selected. Then I map those indices into objects.
klinki commentedon Dec 6, 2016
I saved my updates but for some reason they were not visible. I tried to freeze/unfreeze several times and now it should be visible. (I tested it in browser anonymous mode).
DzmitryShylovich commentedon Dec 6, 2016
Ok now I see.
DzmitryShylovich commentedon Feb 2, 2017
@klinki was fixed here #13349
will be available in 4.0
klinki commentedon Feb 2, 2017
@DzmitryShylovich Thanks!
DzmitryShylovich commentedon Feb 4, 2017
@klinki close the issue pls. thx
angular-automatic-lock-bot commentedon Sep 10, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.