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 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 : ValidationErrors| }
constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn)
validator : ValidatorFn
asyncValidator : AsyncValidatorFn
value : any
The value of the control.
parent : FormGroup|FormArray
The parent control.
status : string
The validation status of the control. There are four possible validation statuses:
These statuses are mutually exclusive, so a control cannot be both valid AND invalid or invalid AND disabled.
valid : boolean
A control is valid
when its status === VALID
.
In order to have this status, the control must have passed all its validation checks.
invalid : boolean
A control is invalid
when its status === INVALID
.
In order to have this status, the control must have failed at least one of its validation checks.
pending : boolean
A control is pending
when its status === PENDING
.
In order to have this status, the control must be in the middle of conducting a validation check.
disabled : boolean
A control is disabled
when its status === DISABLED
.
Disabled controls are exempt from validation checks and are not included in the aggregate value of their ancestor controls.
enabled : boolean
A control is enabled
as long as its status !== DISABLED
.
In other words, it has a status of VALID
, INVALID
, or PENDING
.
errors : ValidationErrors|
Returns any errors generated by failing validation. If there are no errors, it will return null.
exported from forms/index, defined in forms/src/model.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/forms/index/AbstractControl-class.html