填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写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>
}
    

参见

静态方法

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

Provides options for configuring the reactive forms module.

static withConfig(opts: { warnOnNgModelWithFormControl: "never" | "once" | "always"; }): ModuleWithProviders<ReactiveFormsModule>
      
      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>

提供商

提供商
      
      FormBuilder
    
RadioControlRegistry
      
      RadioControlRegistry
    

指令

名称说明
CheckboxControlValueAccessor
      
      CheckboxControlValueAccessor
    

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

CheckboxRequiredValidator
      
      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
      
      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
      
      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
      
      FormArrayName
    

Syncs a nested FormArray to a DOM element.

FormControlDirective
      
      FormControlDirective
    

Synchronizes a standalone FormControl instance to a form control element.

FormControlName
      
      FormControlName
    

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

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

FormGroupDirective
      
      FormGroupDirective
    

Binds an existing FormGroup to a DOM element.

FormGroupName
      
      FormGroupName
    

Syncs a nested FormGroup to a DOM element.

MaxLengthValidator
      
      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.

MinLengthValidator
      
      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.

NgControlStatus
      
      NgControlStatus
    

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

NgControlStatusGroup
      
      NgControlStatusGroup
    

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

NgSelectOption
      
      NgSelectOption
    

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

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

NumberValueAccessor
      
      NumberValueAccessor
    

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
      
      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
      
      RadioControlValueAccessor
    

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
      
      RangeValueAccessor
    

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
      
      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
      
      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
      
      SelectMultipleControlValueAccessor
    

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.