FormControl
Tracks the value and validation status of an individual form control.
This is one of the three fundamental building blocks of Angular forms, along with FormGroup
and FormArray
. It extends the AbstractControl
class that implements most of the base functionality for accessing the value, validation status, user interactions and events.
Interface, extends AbstractControl
setValue
#
setValue(value: any, options: {
onlySelf?: boolean,
emitEvent?: boolean,
emitModelToViewChange?: boolean,
emitViewToModelChange?: boolean
} = {}): void
Sets a new value for the form control.
patchValue
#
patchValue(value: any, options: {
onlySelf?: boolean,
emitEvent?: boolean,
emitModelToViewChange?: boolean,
emitViewToModelChange?: boolean
} = {}): void
Patches the value of a control.
This function is functionally the same as {@link FormControl#setValue setValue} at this level.
It exists for symmetry with {@link FormGroup#patchValue patchValue} on FormGroups
and
FormArrays
, where it does behave differently.
reset
#
reset(formState: any = null, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void
Resets the form control, marking it pristine
and untouched
, and setting
the value to null.
registerOnChange
#
registerOnChange(fn: Function): void
Register a listener for change events.
registerOnDisabledChange
#
registerOnDisabledChange(fn: (isDisabled: boolean) => void): void
Register a listener for disabled events.