New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(forms): the min
and max
validators should work correctly with 0
as a value
#42412
Conversation
c72296d
to
e0ba47b
Compare
@AndrewKushnir PR is ready for hot fix of min and max validator. Let me know if you need me to include anything else in this PR |
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.
Thanks for the fix @iRealNirmal. I've left a comment regarding tests, please have a look when you get a chance.
I'd also propose to update the commit message to provide a bit more info on the problem (especially the title of the commit message that'd be included into the changelog):
fix(forms): the `min` and `max` validators should work correctly with `0` as a value
Prior to this change the `min` and `max` validator directives would not set the `min` and `max` attributes on the host element. The problem was caused by the truthy check in host binding expression that was calculated as `false` when `0` is used as a value. This commit updates the logic to leverage nullish coalescing operator in these host binding expressions, so `0` is treated as a valid value, thus the `min` and `max` attributes are set correctly.
Partially closes #42267.
e89a65b
to
734e98f
Compare
… `0` as a value Prior to this change the `min` and `max` validator directives would not set the `min` and `max` attributes on the host element. The problem was caused by the truthy check in host binding expression that was calculated as `false` when `0` is used as a value. This commit updates the logic to leverage nullish coalescing operator in these host binding expressions, so `0` is treated as a valid value, thus the `min` and `max` attributes are set correctly. Partially closes angular#42267
734e98f
to
44e54d1
Compare
min
and max
validators should work correctly with 0
as a value
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.
Thanks for addressing the feedback @iRealNirmal, the changes look good 👍
I've started tests in Google's codebase and will let you know how it goes.
@iRealNirmal FYI tests in Google's codebase went well, I'm adding this PR to the merge queue. Thanks for the fix 👍 |
… `0` as a value (#42412) Prior to this change the `min` and `max` validator directives would not set the `min` and `max` attributes on the host element. The problem was caused by the truthy check in host binding expression that was calculated as `false` when `0` is used as a value. This commit updates the logic to leverage nullish coalescing operator in these host binding expressions, so `0` is treated as a valid value, thus the `min` and `max` attributes are set correctly. Partially closes #42267 PR Close #42412
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Resolved min and max validator issue as it wasn't working when value was set to 0.
Partially closes #42267
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Min and max validators are not working when it's set to 0.
Issue Number: #42267
What is the new behavior?
min and max validator will work when value is set to 0.
Does this PR introduce a breaking change?
Other information