-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose tree-shakable validator functions via public API #41257
Comments
This is when using Reactive form validation as documented: https://angular.io/guide/reactive-forms#validating-form-input |
Do the method summary comments just need @publicapi to be added? |
The changes in #41189 were to allow internal usages of individual validators to not also pull in all of |
@JoostK Thank you for your explanation. This release would only give a bundle size benefit to people using Template forms. It would be great if it can be extended to my use case using Reactive forms. On a side note, it's good to see forms in general gettings some attention from the NG team. Thank you. |
@penfold thanks for creating this ticket. As Joost mentioned above, the goal of #41189 was to perform internal refactoring to make validators code tree-shakable without changing the API surface. We'll consider adding these standalone validator functions to the public API, but that would require additional discussions/decisions like deprecating
We'll keep this ticket updated once there is any new information available. |
@AndrewKushnir great idea (migration with schematics, if needed) import * as Validators from '@angular/forms/validators';
...
const control = new FormControl('', Validators.required); |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
馃悶 bug report
Affected Package
@angular/forms
Is this a regression?
No
Description
Following #41189 in NG 11.2.6. I was expecting to be able to use the new validator functions directly.
e.g. use requiredValidator instead of Validators.required.
After a bit of digging it would seem that they are marked for internal use (?).
In the forms.d.ts, I expected
傻angular_packages_forms_forms_bb
to berequiredValidator
.馃敩 Minimal Reproduction
N/A
馃敟 Exception or Error
N/A
馃實 Your Environment
Angular Version:
11.2.6
The text was updated successfully, but these errors were encountered: