Defines a part of a form that cannot be divided into other controls. Controls have values and validation state, which is determined by an optional validation function.

Control is one of the three fundamental building blocks used to define forms in Angular, along with ControlGroup and ControlArray.

Usage

By default, a Control is created for every <input> or other form component. With NgFormControl or NgFormModel an existing Control can be bound to a DOM element instead. This Control can be configured with a custom validation function.

Inheritance

Constructors

Control([value = null, ValidatorFn validator = null, AsyncValidatorFn asyncValidator = null ])

Properties

asyncValidator → AsyncValidatorFn

read / write, inherited
dirty → bool

read-only, inherited
errors → Map<String, dynamic>

Returns the errors of this control.

read-only, inherited
hashCode → int

Get a hash code for this object.

read-only, inherited
pending → bool

read-only, inherited
pristine → bool

read-only, inherited
root AbstractControl

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
status → String

read-only, inherited
statusChanges Stream

read-only, inherited
touched → bool

read-only, inherited
untouched → bool

read-only, inherited
valid → bool

read-only, inherited
validator ValidatorFn

read / write, inherited
value → dynamic

read-only, inherited
valueChanges Stream

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

find(path) AbstractControl

inherited
getError(String errorCode, [ List<String> path ]) → dynamic

inherited
hasError(String errorCode, [ List<String> path = null ]) → bool

inherited
markAsDirty({bool onlySelf }) → void

inherited
markAsPending({bool onlySelf }) → void

inherited
markAsTouched() → void

inherited
noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
registerOnChange(Function fn) → void

Register a listener for change events.

setErrors(Map<String, dynamic> errors, { bool emitEvent }) → void

Sets errors on a control.

inherited
setParent(parent) → void

inherited
toString() → String

Returns a string representation of this object.

inherited
updateValue(value, { bool onlySelf, bool emitEvent, bool emitModelToViewChange }) → void

Set the value of the control to value.

updateValueAndValidity({bool onlySelf, bool emitEvent }) → void

inherited