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 has been archived by the owner on Apr 12, 2024. It is now read-only.
However, if use it incorrectly, e.g. ng-attr-multiple="something", it does not spit out an error, and instead while the select box renders as a single select, but the model is an array that never changes despite what is selected via the select box, e.g. it stays as "[]" despite selecting a different value from the select box. Validation/touched is called but not ng-change.
This is expected, because when you are using ng-attr wrong, then the attribute isn't set at all. And because ng-attr is for binding arbitrary attributes, select does not "know" that ng-attr-multiple is trying to set the multiple attribute, it just reacts on multiple directly.
The only warning we could give, would be that ng-attr-multiple didn't receive an expression that could be evaluated on the scope. That is however incompatible with the fact that angular expression are by design forgiving (i.e. they don't throw if a "variable" isn't found). There have been requests to have a mode were something like your example will throw: #12120 You can give it an +1 but it's not high priority.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
ng-attr-multiple is disabled, and if used correctly as in ng-attr-multiple="{{something}}", console correctly spits out a link to https://docs.angularjs.org/error/$compile/selmulti?p0=%3Cselect%20ng-model%3D%22model%22%20ng-required%3D%22mandatory%22%20ng-options%3D%22opt%20for%20opt%20in%20%5B%27One%27,%27Two%27%5D%22%20ng-attr-multiple%3D%22%7B%7Bfalse%7D%7D%22%3E
However, if use it incorrectly, e.g. ng-attr-multiple="something", it does not spit out an error, and instead while the select box renders as a single select, but the model is an array that never changes despite what is selected via the select box, e.g. it stays as "[]" despite selecting a different value from the select box. Validation/touched is called but not ng-change.
http://jsfiddle.net/wauv8n6y/1/
While this was my error for using ng-attr-multiple incorrectly, it should likely fail a bit better then it currently does.
The text was updated successfully, but these errors were encountered: