填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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
    

一個 ControlValueAccessor,用於寫入值並監聽複選框輸入元素上的更改。

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

指令自動應用於 Angular 表單控制元件,該控制元件會根據控制元件狀態設定 CSS 類別。

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

NgControlStatusGroup
      
      NgControlStatusGroup
    

該指令自動應用於 Angular 表單組,基於控制元件的狀態(有效、無效、髒等)設定 CSS 類別。

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
    

建立 FormGroup 的實例並將其繫結到 DOM 元素。

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
    

用於寫入數字值和監聽數字輸入框更改的 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
      
      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
    

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

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.