Reactive Forms
Angular Framework has Template Driven Forms and Model-Driven Forms (Reactive Forms). Template Driven Forms is HTML centric, whereas Model Driven Forms is typescript centric via the Reactive Forms.
Reactive Forms provides the flexibility of validation, unit testing, and code splitting.
Custom Form Control
When creating custom components, we need to implement ControlValueAccessor
and provide it via NG_VALUE_ACCESSOR
to communicate with Angular Forms API.
Building Blocks
FormControl
maps to individual HTML input element.FromGroup
group of individualFormContral
instances.FormArray
is an array ofFormControl
,FormGroup
, orFormArray
instances.
Validators
NG_VALIDATORS
—InjectionToken
for registering additional synchronous validators used withAbstractControl
s.