-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngOption): accept 0
as an option group
#7024
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Accept `0` and an option group Close angular#7015 BREAKING CHANGE When using option groups at an ng-option, the literal `0` will be handled as a group with label `'0'`. Use the literal string `''` or undefined for options that should not be in any option group
Is this really a "breaking" change? seems like that was probably accidental, not an intentional thing. But it's all good, good job coming up with a fix |
@caitp Now we accept all falsy values (with the exception of |
seems unlikely, if they're using ngOptions, they probably aren't using 'null' as an expression, since it would apply to all optgroups... |
ok, let me know if you would like me to amend the commit message |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
Sorry @lgalfaso this needs a hefty rebase since ngOptions has changed so much. |
But it seems that your new unit test does not fail with the refactored code, so I think this issue is actually already fixed. |
Ah! Actually, your unit test uses |
Now one can use `''`, `0`, `false` and `null` as option groups. Previously all of these falsy values were treated as the option not being a member of a group. Closes angular#7015 Closes angular#7024 BREAKING CHANGES If your data contains falsy values for option groups, then these options will now be placed into option groups. Only option groups that are `undefined` will result in the option being put in no group. If you have data that contains falsy values that should not be used as groups then you must filter the values before passing them to `ngOptions` converting falsy values to `undefined`.
Replacing with #12888 |
Now one can use `''`, `0`, `false` and `null` as option groups. Previously all of these falsy values were treated as the option not being a member of a group. Closes #7015 Closes #7024 Closes #12888 BREAKING CHANGES If your data contains falsy values for option groups, then these options will now be placed into option groups. Only option groups that are `undefined` will result in the option being put in no group. If you have data that contains falsy values that should not be used as groups then you must filter the values before passing them to `ngOptions` converting falsy values to `undefined`.
Accept
0
and an option groupClose #7015
BREAKING CHANGE
When using option groups at an ng-option, the literal
0
willbe handled as a group with label
'0'
. Use the literal string''
or undefined for options that should not be in any option group