FormBuilder
Creates an AbstractControl
from a user-specified configuration.
class FormBuilder {
group(controlsConfig: { [key: string]: any; }, options: AbstractControlOptions | { [key: string]: any; } = null): FormGroup
control(formState: any, validatorOrOpts?: ValidatorFn | AbstractControlOptions | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]): FormControl
array(controlsConfig: any[], validatorOrOpts?: ValidatorFn | AbstractControlOptions | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]): FormArray
}
See also
Description
The FormBuilder
provides syntactic sugar that shortens creating instances of a FormControl
,
FormGroup
, or FormArray
. It reduces the amount of boilerplate needed to build complex
forms.
Methods
Construct a new |
||||||
Parameters
Returns |
Construct a new |
|||||||||
Parameters
Returns |
|||||||||
Usage NotesInitialize a control as disabledThe following example returns a control with an initial value in a disabled state.
|
Constructs a new |
|||||||||
Parameters
Returns |