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

select option with ngValue="undefined" doesn't put undefined on ngModel #16653

Closed
1 of 3 tasks
Jorge-Martins opened this issue Aug 2, 2018 · 0 comments · Fixed by #16656
Closed
1 of 3 tasks

select option with ngValue="undefined" doesn't put undefined on ngModel #16653

Jorge-Martins opened this issue Aug 2, 2018 · 0 comments · Fixed by #16656

Comments

@Jorge-Martins
Copy link

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:

When adding options with ngRepeat, if one of the options has ngValue="undefined" and ngModel is currently undefined, AngularJS still adds the unknown model option with value "? undefined:undefined ?" instead of the element with value "undefined:undefined" being selected. Moreover, if we select the element with value "undefined:undefined" the model is set to null instead of being undefined. For all the remaining values the behavior is as expected.

Expected / new behavior:

We expected that the option with value "? undefined:undefined ?" would not be added by AngularJS and that the selected option would be the one with ngValue="undefined". Also, we expected the ngModel to be set to undefined when that same option with ngValue="undefined" is selected.

Minimal reproduction of the problem with instructions:

https://plnkr.co/edit/5jIspWCuuMFl5CEhHexD?p=preview

AngularJS version: 1.6.x, 1.7.x

Browser: [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

all
Anything else:

@Narretz Narretz added this to the 1.7.x milestone Aug 3, 2018
Narretz added a commit to Narretz/angular.js that referenced this issue Aug 3, 2018
Previously, the value observer incorrectly assumed a value had changed even if
it was the first time it was set, which caused it to remove an option with
the value `undefined` from the internal option map.

Fixes angular#16653
@Narretz Narretz self-assigned this Aug 3, 2018
Narretz added a commit that referenced this issue Aug 6, 2018
Previously, the value observer incorrectly assumed a value had changed even if
it was the first time it was set, which caused it to remove an option with
the value `undefined` from the internal option map.

Fixes #16653
Closes #16656
Narretz added a commit that referenced this issue Aug 8, 2018
Previously, the value observer incorrectly assumed a value had changed even if
it was the first time it was set, which caused it to remove an option with
the value `undefined` from the internal option map.

Fixes #16653
Closes #16656
kfeinUI pushed a commit to kfeinUI/angular.js that referenced this issue Aug 14, 2018
Previously, the value observer incorrectly assumed a value had changed even if
it was the first time it was set, which caused it to remove an option with
the value `undefined` from the internal option map.

Fixes angular#16653
Closes angular#16656
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants