Angular provides two ways of creating forms. We looked at one of these ways in Chapter 2, Building a Flashcard Game Using Angular, using template-driven forms. Template-driven forms are good for creating simple forms using ngModel. If we wish to create any complex forms in a flexible way, we need to use reactive forms. Reactive forms are created in the Component class instead of the templates. We have more control over the definition of the form and can create complex form groups, all of which can have controls, groups of controls, and arrays of controls/groups.
Reactive forms provide three different building blocks, FormControl, FormGroup, and FormArray. All three have one base class called AbstractControl. They share some common methods to get the values, the state of the form elements, and the controlling validations, and some methods are...