-
Notifications
You must be signed in to change notification settings - Fork 26.9k
feat(forms): introduce min and max validators #39063
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
Conversation
fe44e5e to
6fea537
Compare
|
Initial presubmit to see if it breaks targets in g3 (+ global presubmit as well). |
3492716 to
971cf8d
Compare
c16413b to
354c930
Compare
6fea895 to
c9fde70
Compare
b8ddaff to
9540729
Compare
|
@AndrewKushnir Thanks for the updated information. The changes and the refactor of the unit tests look good to me. |
jessicajaniuk
left a comment
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.
reviewed-for: public-api
This commit adds the missing `min` and `max` validators. BREAKING CHANGE: Previously `min` and `max` attributes defined on the `<input type="number">` were ignored by Forms module. Now presence of these attributes would trigger min/max validation logic (in case `formControl`, `formControlName` or `ngModel` directives are also present on a given input) and corresponding form control status would reflect that. Fixes angular#16352
49c77c0 to
76d699b
Compare
|
You can preview 76d699b at https://pr39063-76d699b.ngbuilds.io/. |
|
Thanks for the review @atscott, great catch on I've pushed a fixup commit to adjust types. Could you please have another look when you get a chance? |
|
FYI, also started a new Global Presubmit. |
atscott
left a comment
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.
reviewed-for: public-api
|
The feedback was addressed and the most recent TGP run is successful, so I'm adding this PR to the merge queue. @sonukapoor huge thanks for working on this feature and addressing all the comments 👍 |
|
Note to Caretaker: this PR is ready for merge, the TGP is "green" (only one unrelated build failure). It'd still be great to sync it in g3 as a separate/individual change to rollback easier if needed. Thank you. |
|
Always a pleasure @AndrewKushnir |
|
Does this affect applications which specify both the attribute and separately a corresponding validator in any way? Or would the validator then just run twice without noticable effects? |
|
@Airblader this change adds new min/max validators that would be invoked on |
|
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. |
This commit adds the missing
minandmaxvalidators.BREAKING CHANGE:
Previously
minandmaxattributes defined on the<input type="number">were ignored by Forms module. Now presence of these attributes would
trigger min/max validation logic (in case
formControl,formControlNameor
ngModeldirectives are also present on a given input) andcorresponding form control status would reflect that.
Fixes #16352
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?