@angular/forms

入口点

主要

@angular/forms

导出列表

AbstractControlDirective

Base class for control directives.

AbstractFormGroupDirective

This is a base class for code shared between NgModelGroup and FormGroupName.

ControlContainer

A directive that contains multiple NgControls.

NgControl

A base class that all control directive extend. It binds a FormControl object to a DOM element.

FormBuilder

Creates an AbstractControl from a user-specified configuration.

使用用户指定的配置创建 AbstractControl

AbstractControl

This is the base class for FormControl, FormGroup, and FormArray.

这是 FormControlFormGroupFormArray 的基类。

FormArray

Tracks the value and validity state of an array of FormControl, FormGroup or FormArray instances.

跟踪一个控件数组的值和有效性状态,控件可以是 FormControlFormGroupFormArray 的实例。

FormControl

Tracks the value and validation status of an individual form control.

跟踪独立表单控件的值和验证状态。

FormGroup

Tracks the value and validity state of a group of FormControl instances.

跟踪一组 FormControl 实例的值和有效性状态。

Validators

Provides a set of built-in validators that can be used by form controls.

提供一组内置验证器,可用于各种表单控件。

FormsModule

The ng module for forms.

模板驱动表单的 NgModule。

ReactiveFormsModule

The ng module for reactive forms.

响应式表单的 NgModule。

结构

ControlValueAccessor

A ControlValueAccessor acts as a bridge between the Angular forms API and a native element in the DOM.

Form

An interface that FormGroupDirective and NgForm implement.

FormGroupDirectiveNgForm 实现的接口。

AsyncValidator
AsyncValidatorFn
Validator

An interface that can be implemented by classes that can act as validators.

一个接口,实现了它的类可以扮演验证器的角色。

ValidatorFn
AbstractControlOptions

Interface for options provided to an AbstractControl.

提供给 AbstractControl 的配置项接口。

指令

CheckboxControlValueAccessor

The accessor for writing a value and listening to changes on a checkbox input element.

DefaultValueAccessor

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

NgControlStatus

Directive automatically applied to Angular form controls that sets CSS classes based on control status. The following classes are applied as the properties become true:

NgControlStatusGroup

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

NgForm

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

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

NgModel

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

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

NgModelGroup

Creates and binds a FormGroup instance to a DOM element.

RadioControlValueAccessor

Writes radio control values and listens to radio control changes.

FormControlDirective

Syncs a standalone FormControl instance to a form control element.

FormControlName

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

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

FormGroupDirective

Binds an existing FormGroup to a DOM element.

FormArrayName

Syncs a nested FormArray to a DOM element.

FormGroupName

Syncs a nested FormGroup to a DOM element.

NgSelectOption

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

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

SelectControlValueAccessor

Writes values and listens to changes on a select element.

select 元素上写入值并监听其变更。

SelectMultipleControlValueAccessor

The accessor for writing a value and listening to changes on a select element.

CheckboxRequiredValidator

A Directive that adds the required validator to checkbox controls marked with the required attribute, via the NG_VALIDATORS binding.

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

EmailValidator

A Directive that adds the email validator to controls marked with the email attribute, via the NG_VALIDATORS binding.

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

MaxLengthValidator

A directive which installs the MaxLengthValidator for any formControlName, formControl, or control with ngModel that also has a maxlength attribute.

MinLengthValidator

A directive which installs the MinLengthValidator for any formControlName, formControl, or control with ngModel that also has a minlength attribute.

PatternValidator

A Directive that adds the pattern validator to any controls marked with the pattern attribute, via the NG_VALIDATORS binding. Uses attribute value as the regex to validate Control value against. Follows pattern attribute semantics; i.e. regex must match entire Control value.

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

RequiredValidator

A Directive that adds the required validator to any controls marked with the required attribute, via the NG_VALIDATORS binding.

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

类型

NG_VALUE_ACCESSOR

Used to provide a ControlValueAccessor for form controls.

COMPOSITION_BUFFER_MODE

Turn this mode on if you want form directives to buffer IME input until compositionend

ValidationErrors
NG_ASYNC_VALIDATORS

An InjectionToken for registering additional asynchronous validators used with AbstractControls.

一个 InjectionToken,用于注册额外的异步验证器,供 AbstractControl 使用。

NG_VALIDATORS

An InjectionToken for registering additional synchronous validators used with AbstractControls.

一个 InjectionToken,用于注册额外的同步验证器,供 AbstractControl 使用。