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

Commit d7f7302

Browse files
committed
fix(select): force visual update in IE
IE9, IE10 and IE11 would always show the first <option> as selected when the user moves from a null <option> to a non-null one in a non-null <select>. Even though the model was being updated correctly, visually, the first <option> always appeared selected. Setting the `selected` property twice in a row seems to fix it in all the three versions mentioned above. Closes #7692 Closes #8158
1 parent db9f257 commit d7f7302

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ng/directive/select.js

+6
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
546546
// lastElement.prop('selected') provided by jQuery has side-effects
547547
if (existingOption.selected !== option.selected) {
548548
lastElement.prop('selected', (existingOption.selected = option.selected));
549+
if (msie) {
550+
// See #7692
551+
// The selected item wouldn't visually update on IE without this.
552+
// Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well
553+
lastElement.prop('selected', existingOption.selected);
554+
}
549555
}
550556
} else {
551557
// grow elements

0 commit comments

Comments
 (0)