FormBuilder
使用用户指定的配置创建 AbstractControl
。
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
}
参见
说明
FormBuilder
提供了一个语法糖,以简化 FormControl
、FormGroup
或 FormArray
实例的创建过程。 它会减少构建复杂表单时所需的样板代码的数量。
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.
方法
构建一个新的 Construct a new | ||||||
参数
返回值 |
构建一个新的 Construct a new | |||||||||
参数
返回值 | |||||||||
使用说明把控件初始化为禁用状态Initialize a control as disabled下面的例子返回一个带有初始值并已禁用的控件。 The following example returns a control with an initial value in a disabled state.
|
构造一个新的 Constructs a new | |||||||||
参数
返回值 |