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 }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Regression using ngOptions asynchronously in angular 1.3 #9714
I just ran into this same issue (plunker here: http://plnkr.co/edit/NgPGrklA3ng6bmnPjxmw?p=preview) and ended up with the same solution (pre-filling the options holder with the known selected value). The workaround is kind of ugly but not terrible.
Tested in Firefox, Chrome and Safari but did not see the behavior in Firefox. Only tested on OS X.
self.addOption = function(value, element) {
assertNotHasOwnProperty(value, '"option value"');
optionsMap[value] = true;
if (ngModelCtrl.$viewValue == value) {
$element.val(value);
if (unknownOption.parent()) unknownOption.remove();
}
// Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
// Adding an <option selected="selected"> element to a <select required="required"> should
// automatically select the new element
if (element && element[0].hasAttribute('selected')) {
element[0].selected = true;
}
};
and the code make the select don't show the real value.
if (ngModelCtrl.$viewValue == value) {
$element.val(value);
if (unknownOption.parent()) unknownOption.remove();
}
Activity
anotherchrisberry commentedon Oct 29, 2014
I just ran into this same issue (plunker here: http://plnkr.co/edit/NgPGrklA3ng6bmnPjxmw?p=preview) and ended up with the same solution (pre-filling the options holder with the known selected value). The workaround is kind of ugly but not terrible.
Tested in Firefox, Chrome and Safari but did not see the behavior in Firefox. Only tested on OS X.
ajohnston256 commentedon Nov 22, 2014
Can you assign this to me? I think I see the problem, and I'll try to get a pull request ready for tomorrow.
fix(select): allow $timeout to initialize ngOptions
fix(select): allow ngOptions to be set in $timeout
fix(select): allow ngOptions to be set in $timeout
fix(select): allow ngOptions to be set in $timeout
39 remaining items
angrytoro commentedon Dec 29, 2014
maybe it cause by the code
and the code make the select don't show the real value.
fix(ngOptions): ensure that the correct option is selected when optio…
petebacondarwin commentedon Jan 4, 2015
@angrytoro - this is the right idea but
ngOptionsneeds a full refactoring, I have provided a PR in #10639...fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…
fix(ngOptions): ensure that the correct option is selected when optio…