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