{ "id": "api/forms/NgControl", "title": "NgControl", "contents": "\n\n
\n
\n
\n \n API > @angular/forms\n
\n \n
\n \n
\n

NgControllink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

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

\n\n \n
\n \n \n \n
\n\nabstract class NgControl extends AbstractControlDirective {\n name: string | number | null\n valueAccessor: ControlValueAccessor | null\n abstract viewToModelUpdate(newValue: any): void\n\n // inherited from forms/AbstractControlDirective\n abstract control: AbstractControl | null\n value: any\n valid: boolean | null\n invalid: boolean | null\n pending: boolean | null\n disabled: boolean | null\n enabled: boolean | null\n errors: ValidationErrors | null\n pristine: boolean | null\n dirty: boolean | null\n touched: boolean | null\n status: string | null\n untouched: boolean | null\n statusChanges: Observable<any> | null\n valueChanges: Observable<any> | null\n path: string[] | null\n validator: ValidatorFn | null\n asyncValidator: AsyncValidatorFn | null\n reset(value: any = undefined): void\n hasError(errorCode: string, path?: string | (string | number)[]): boolean\n getError(errorCode: string, path?: string | (string | number)[]): any\n}\n\n\n \n \n
\n

Subclasseslink

\n \n\n\n\n\n
\n \n\n
\n\n\n \n\n \n \n \n\n\n\n\n\n\n\n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n name: string | number | null\n \n \n

The name for the control

\n\n \n
\n \n valueAccessor: ControlValueAccessor | null\n \n \n

The value accessor for the control

\n\n \n
\n
\n\n\n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n viewToModelUpdate()\n \n link

\n \n
\n
\n

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

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

The new value for the view

\n\n
\n\n \n
Returns
\n

void

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n\n \n\n\n
\n
\n\n\n" }