AbstractControl

Stable

Class

What it does

This is the base class for FormControl, FormGroup, and FormArray.

It provides some of the shared behavior that all controls and groups of controls have, like running validators, calculating status, and resetting state. It also defines the properties that are shared between all sub-classes, like value, valid, and dirty. It shouldn't be instantiated directly.

Class Overview

class AbstractControl {
constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn)

validator : ValidatorFn
asyncValidator : AsyncValidatorFn
value : any
parent : FormGroup|FormArray
status : string
valid : boolean
invalid : boolean
pending : boolean
disabled : boolean
enabled : boolean
errors : {[key: string]: any}
pristine : boolean
dirty : boolean
touched : boolean
untouched : boolean
valueChanges : Observable<any>
statusChanges : Observable<any>
setValidators(newValidator: ValidatorFn|ValidatorFn[]) : void
setAsyncValidators(newValidator: AsyncValidatorFn|AsyncValidatorFn[]) : void
clearValidators() : void
clearAsyncValidators() : void
markAsTouched({onlySelf}?: {onlySelf?: boolean}) : void
markAsUntouched({onlySelf}?: {onlySelf?: boolean}) : void
markAsDirty({onlySelf}?: {onlySelf?: boolean}) : void
markAsPristine({onlySelf}?: {onlySelf?: boolean}) : void
markAsPending({onlySelf}?: {onlySelf?: boolean}) : void
disable({onlySelf, emitEvent}?: {onlySelf?: boolean, emitEvent?: boolean}) : void
enable({onlySelf, emitEvent}?: {onlySelf?: boolean, emitEvent?: boolean}) : void
setParent(parent: FormGroup|FormArray) : void
setValue(value: any, options?: Object) : void
patchValue(value: any, options?: Object) : void
reset(value?: any, options?: Object) : void
updateValueAndValidity({onlySelf, emitEvent}?: {onlySelf?: boolean, emitEvent?: boolean}) : void
setErrors(errors: {[key: string]: any}, {emitEvent}?: {emitEvent?: boolean}) : void
get(path: Array<string|number>|string) : AbstractControl
getError(errorCode: string, path?: string[]) : any
hasError(errorCode: string, path?: string[]) : boolean
root : AbstractControl

}

Class Description

Constructor

constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn)

Class Details

exported from @angular/forms/index, defined in @angular/forms/src/model.ts