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

Commit c0afbfa

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 bf13d26 commit c0afbfa

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
@@ -540,6 +540,12 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
540540
// lastElement.prop('selected') provided by jQuery has side-effects
541541
if (existingOption.selected !== option.selected) {
542542
lastElement.prop('selected', (existingOption.selected = option.selected));
543+
if (msie) {
544+
// See #7692
545+
// The selected item wouldn't visually update on IE without this.
546+
// Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well
547+
lastElement.prop('selected', existingOption.selected);
548+
}
543549
}
544550
} else {
545551
// grow elements

0 commit comments

Comments
 (0)