填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ReactiveFormsModule

导出响应式表单所需的基础设施和指令,使其能用于任何导入了本模块的 NgModule 中。

Exports the required infrastructure and directives for reactive forms, making them available for import by NgModules that import this module.

查看"说明"...

      
      class ReactiveFormsModule {
  static withConfig(opts: { warnOnNgModelWithFormControl: "never" | "once" | "always"; }): ModuleWithProviders<ReactiveFormsModule>
}
    

参见

说明

Providers associated with this module:

静态方法

提供了一些选项,供配置响应式表单模块。

Provides options for configuring the reactive forms module.

      
      static withConfig(opts: { warnOnNgModelWithFormControl: "never" | "once" | "always"; }): ModuleWithProviders<ReactiveFormsModule>
    
参数
opts object

一个配置选项对象

An object of configuration options

  • warnOnNgModelWithFormControl 配置了当 ngModel 绑定与响应式表单指令一起使用时,发出警告的时机。

    warnOnNgModelWithFormControl Configures when to emit a warning when an ngModel binding is used with reactive form directives.

返回值

ModuleWithProviders<ReactiveFormsModule>

提供商

提供商
      
      { provide: FormBuilder, useClass: FormBuilder }
    

指令

名称说明
      
      CheckboxControlValueAccessor
    

一个 ControlValueAccessor,用于写入值并监听复选框输入元素上的更改。

A ControlValueAccessor for writing a value and listening to changes on a checkbox input element.

      
      CheckboxRequiredValidator
    

该指令会借助 NG_VALIDATORS 绑定把 required 验证器添加到任何带有 required 属性的检查框控件上。

A Directive that adds the required validator to checkbox controls marked with the required attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      DefaultValueAccessor
    

The default ControlValueAccessor for writing a value and listening to changes on input elements. The accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      EmailValidator
    

该指令会借助 NG_VALIDATORS 绑定把 email 验证器添加到任何带有 email 属性的控件上。

A directive that adds the email validator to controls marked with the email attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      FormArrayName
    

将嵌套的 FormArray 同步到 DOM 元素。

Syncs a nested FormArray to a DOM element.

      
      FormControlDirective
    

将独立的 FormControl 实例同步到表单控件元素。

Synchronizes a standalone FormControl instance to a form control element.

      
      FormControlName
    

根据名字将现有 FormGroup 中的 FormControl 与一个表单控件进行同步。

Syncs a FormControl in an existing FormGroup to a form control element by name.

      
      FormGroupDirective
    

将现有的 FormGroup 绑定到 DOM 元素。

Binds an existing FormGroup to a DOM element.

      
      FormGroupName
    

将嵌套的 FormGroup 同步到 DOM 元素上。

Syncs a nested FormGroup to a DOM element.

      
      MaxLengthValidator
    

该指令用于为带有 maxlength 属性的控件添加最大长度验证器。该指令会提供 NG_VALIDATORS 多重提供者列表。

A directive that adds max length validation to controls marked with the maxlength attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      MaxValidator
    

A directive which installs the MaxValidatorfor any formControlName, formControl, or control with ngModel that also has a max attribute.

      
      MinLengthValidator
    

该指令用于为带有 minlength 属性的控件添加最小长度验证器。该指令会提供 NG_VALIDATORS 多重提供者列表。

A directive that adds minimum length validation to controls marked with the minlength attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      MinValidator
    

A directive which installs the MinValidatorfor any formControlName, formControl, or control with ngModel that also has a min attribute.

      
      NgControlStatus
    

指令自动应用于 Angular 表单控件,该控件会根据控件状态设置 CSS 类。

Directive automatically applied to Angular form controls that sets CSS classes based on control status.

      
      NgControlStatusGroup
    

该指令自动应用于 Angular 表单组,基于控件的状态(有效、无效、脏等)设置 CSS 类。

Directive automatically applied to Angular form groups that sets CSS classes based on control status (valid/invalid/dirty/etc).

      
      NgSelectOption
    

把选项 <option> 标记为动态的,这样 Angular 就会在选项变化时得到通知。

Marks <option> as dynamic, so Angular can be notified when options change.

      
      NumberValueAccessor
    

用于写入数字值和监听数字输入框更改的 ControlValueAccessor。这个值访问器由 FormControlDirectiveFormControlNameNgModel 指令使用。

The ControlValueAccessor for writing a number value and listening to number input changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      PatternValidator
    

该指令会借助 NG_VALIDATORS 绑定来把 pattern 验证器添加到任何带有 pattern 属性的控件上。 它会使用该属性的值作为正则表达式来验证控件的值。 它会遵循 pattern 属性的语义,也就是说,该正则表达式必须匹配整个控件值。

A directive that adds regex pattern validation to controls marked with the pattern attribute. The regex must match the entire control value. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      RadioControlValueAccessor
    

ControlValueAccessor 用于写入单选控件的值和监听单选控件值的更改。这个值访问器由 FormControlDirectiveFormControlNameNgModel 指令使用。

The ControlValueAccessor for writing radio control values and listening to radio control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      RangeValueAccessor
    

ControlValueAccessor 用于写入范围输入器的值,并监听范围输入器的变化。它被 FormControlDirectiveFormControlNameNgModel 使用。

The ControlValueAccessor for writing a range value and listening to range input changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      RequiredValidator
    

该指令会借助 NG_VALIDATORS 绑定把 required 验证器添加到任何带 required 属性的控件上。

A directive that adds the required validator to any controls marked with the required attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      SelectControlValueAccessor
    

ControlValueAccessor 用于写入 select 控件的值,并监听 select 控件的变化。该值访问器会被 FormControlDirectiveFormControlNameNgModel 指令使用。

The ControlValueAccessor for writing select control values and listening to select control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      SelectMultipleControlValueAccessor
    

ControlValueAccessor 用于写入多选控件值和监听多选控件更改。这个值访问器由 FormControlDirectiveFormControlNameNgModel 指令使用。

The ControlValueAccessor for writing multi-select control values and listening to multi-select control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.