Help Angular by taking a 1 minute survey!Go to surveyHome

NgControl

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

abstract class NgControl extends AbstractControlDirective { name: string | null valueAccessor: ControlValueAccessor | null validator: ValidatorFn | null asyncValidator: AsyncValidatorFn | null abstract viewToModelUpdate(newValue: any): void // inherited from 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 reset(value: any = undefined): void hasError(errorCode: string, path?: string | (string | number)[]): boolean getError(errorCode: string, path?: string | (string | number)[]): any }
      
      abstract class NgControl extends AbstractControlDirective {
  name: string | null
  valueAccessor: ControlValueAccessor | null
  validator: ValidatorFn | null
  asyncValidator: AsyncValidatorFn | null
  abstract viewToModelUpdate(newValue: any): void

  // inherited from 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
  reset(value: any = undefined): void
  hasError(errorCode: string, path?: string | (string | number)[]): boolean
  getError(errorCode: string, path?: string | (string | number)[]): any
}
    

Properties

Property Description
name: string | null

The name for the control

valueAccessor: ControlValueAccessor | null

The value accessor for the control

validator: ValidatorFn | null Read-only.

The registered synchronous validator function for the control

asyncValidator: AsyncValidatorFn | null Read-only.

The registered async validator function for the control

Methods

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

abstract viewToModelUpdate(newValue: any): void
      
      abstract viewToModelUpdate(newValue: any): void
    
Parameters
newValue any

The new value for the view

Returns

void