formBuilder.group
method's input controlsConfig
has type as any
, but as it uses FormControl constructor, we can use all the properties available in FormControl.
FormBuilder's group
group(controlsConfig: {
[key: string]: any;
}, options?: AbstractControlOptions | {
[key: string]: any;
} | null): FormGroup;
FormControl's constructor
constructor(
formState?: any,
validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null,
asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null
);
So we can make use of all available inputs for FormControl
including in updateOn
for each FormControl
as below.
{
field1: ['', [Validators.email, Validators.required]],
field2: ['', {validators: Validators.required, updateOn: 'submit'}]
},