-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(select): update option if interpolated value attribute changes #12582
Conversation
a4f953f
to
e1a6f1d
Compare
selectCtrl.addOption(attr.value, element); | ||
selectCtrl.ngModelCtrl.$render(); | ||
chromeHack(element); | ||
// Either the value attribute or the text content is static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment would be more accurate as "Both the value attribute and the text content are static", right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's a bit obscure: If the attr is defined, we create an interpolation fn for it (to check if we should observe). We then skip everything related to the option text, because the value takes precedence over it. Which means, while the option value attr might not be interpolated, the option text could still be. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right; then both wordings are inaccurate. It should be more like:
Either the value attribute exists and is static or it doesn't exists and the text content is static
(which although more accurate sounds messy anyway - so I leave it up to you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just noting that the attr value is static should be enough then. The code isn't that big, it should be relatively easy to find out what exactly happens.
e1a6f1d
to
7303281
Compare
fca2008
to
dadb278
Compare
This is for options added without ngOptions. Previously, an option with an interpolated value attribute would not be updated if the binding changed, i.e. the select controller would not recognize the changed option. Now the value attribute will be observed if it contains an interpolation. Closes angular#12005 Closes angular#12582
This is for options added without ngOptions. Previously, an option with an interpolated value attribute would not be updated if the binding changed, i.e. the select controller would not recognize the changed option. Now the value attribute will be observed if it contains an interpolation. Closes angular#12005 Closes angular#12582
dadb278
to
e14b80e
Compare
Previously, the option would only update if the fallback
(the interpolated option text) was used. Now the value attribute will
be observed if it contains an interpolation.
Closes #12005