填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

NgControl

FormControl 的指令擴充套件的基底類別。它將 FormControl 物件繫結到 DOM 元素。

A base class that all FormControl-based directives extend. It binds a FormControl object to a DOM element.

      
      abstract class NgControl extends AbstractControlDirective {
  name: string | number | null
  valueAccessor: ControlValueAccessor | null
  abstract viewToModelUpdate(newValue: any): void

  // 繼承自 forms/AbstractControlDirective
  abstract control: AbstractControl | null
  value: any
  valid: boolean | null
  invalid: boolean | null
  pending: boolean | null
  disabled: boolean | null
  enabled: boolean | null
  errors: ValidationErrors | null
  pristine: boolean | null
  dirty: boolean | null
  touched: boolean | null
  status: string | null
  untouched: boolean | null
  statusChanges: Observable<any> | null
  valueChanges: Observable<any> | null
  path: string[] | null
  validator: ValidatorFn | null
  asyncValidator: AsyncValidatorFn | null
  reset(value: any = undefined): void
  hasError(errorCode: string, path?: string | (string | number)[]): boolean
  getError(errorCode: string, path?: string | (string | number)[]): any
}
    

屬性

屬性說明
name: string | number | null

控制元件的名稱

The name for the control

valueAccessor: ControlValueAccessor | null

控制元件的值訪問器

The value accessor for the control

方法

按需從檢視更新模型的回呼(Callback)方法

The callback method to update the model from the view when requested

      
      abstract viewToModelUpdate(newValue: any): void
    
引數
newValue any

檢視的新值

The new value for the view

返回值

void