Angular Reactive Form Implementation Checklist
June 7, 2021 · 1 min readLucian CiobanuNote to self on quick form creation:
-
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-
private fb: FormBuilder -> add to constructor
-
in the constructor initiate this.form = this.fb.group({formControlName: [null, Validators.required]) and add one property for each form control you need
the formControlName key in the object can be any form control name you want as long as you use it between the " " on point 5 below.
-
in html do a form with directive [formGroup]="form"
-
add formControlName="formControlName" to the select, radio or input you have inside your form and want to get data from.
with Angular its that easy!
Hope this helped!
Cheers,
Lucian

Web Development & Software Delivery