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

FormsModule

导出模板驱动表单所需的提供商和指令,使其可用于导入了该模块的 NgModule 中。

Exports the required providers and directives for template-driven forms, making them available for import by NgModules that import this module.

class FormsModule { }
      
      class FormsModule {
}
    

参见

提供商

提供商
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.

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

NgForm
      
      NgForm
    

创建一个顶级的 FormGroup 实例,并把它绑定到一个表单,以跟踪表单的聚合值及其验证状态。

Creates a top-level FormGroup instance and binds it to a form to track aggregate form value and validation status.

NgModel
      
      NgModel
    

根据领域对象创建一个 FormControl 实例,并把它绑定到一个表单控件元素上。

Creates a FormControl instance from a domain model and binds it to a form control element.

NgModelGroup
      
      NgModelGroup
    

Creates and binds a FormGroup instance to a DOM element.

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.