-
Notifications
You must be signed in to change notification settings - Fork 78
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
Warning about usage of options and async validators #612
Comments
alizedebray
added a commit
to alizedebray/rxweb
that referenced
this issue
Jan 16, 2023
the validators argument of the FormControl should not be used when validators are configured in the options argument. Fixes rxweb#612
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using RxFormBuilder with entities decorated with async() the following warning is issued at runtime multiple times:
It looks like you're constructing using a FormControl with both an options argument and an
async validators argument. Mixing these arguments will cause your async validators to be dropped.
You should either put all your validators in the options object, or in separate validators
arguments. For example:
// Using validators arguments
fc = new FormControl(42, Validators.required, myAsyncValidator);
// Using AbstractControlOptions
fc = new FormControl(42, {validators: Validators.required, asyncValidators: myAV});
// Do NOT mix them: async validators will be dropped!
fc = new FormControl(42, {validators: Validators.required}, /* Oops! */ myAsyncValidator);
Expected Behavior
No warnings shown at runtime
To Reproduce
Create a FormGroup using an entity with synchronous and async validators.
Url (stackblitz or plunker or other)
Package Version
@rxweb/[email protected]
The text was updated successfully, but these errors were encountered: