FormGroup in Angular
This Article helps you to Understand, FormGroup in Angular
Building Blocks of Angular Forms
Whether you use a template-driven or reactive forms strategy, the Angular Forms module has three building components.
FormControl, FormGroup and FormArray
FormGroup
A
FormGroup is a group of FormControls. With the control name serving as
the key, each FormControl acts as a property in a FormGroup.
There are frequently multiple fields on forms. It is useful to have an easy way to coordinate the Form controls.
Each
of the aforementioned input fields is shown as a distinct FormControl.
We would need to verify the legality of each and every FormControl if we
wanted to validate our form. Imagine a form with numerous fields. To
cycle over a large number of FormControls and verify their validity is
laborious.
This problem is resolved by FormGroup by offering a
wrapper interface for a set of FormControls.Each child FormControl's
state is tracked by a FormGroup, which compiles the values into a single
object. each control name serving as the key
Map FormGroup in Template
Validate in TS file Itself