Issue
Is it possible to instantiate FormControl
using both ValidatorFn
and AbstractControlOptions
at the same time, as in the following example?
new FormControl(null, Validators.required, { updateOn : 'change' });
Looking at the form.d.ts
file, it doesn't seem possible:
constructor(
formState?: any,
validatorOrOpts?:
| ValidatorFn
| ValidatorFn[]
| AbstractControlOptions
| null,
asyncValidator?:
| AsyncValidatorFn
| AsyncValidatorFn[]
| null
){}
However, as this is a pretty common requirement, I think it should be possible, is there any way to accomplish this?
Solution
What you need is the below thing?
new FormControl(null, {
validators: Validators.required,
updateOn: 'change'
});
Answered By - Miracle
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.