January 2018
Intermediate to advanced
348 pages
8h 17m
English
In the earlier reactive example seen, we built the FormGroup and FormControl instances without using a FormBuilder. A more convenient option is to make use of the FormBuilder which leads to setup code like the following, which is simpler to read:
constructor(fb: FormBuilder) { this.formGroup = fb.group({ email: null, phone: null });}
Arguably, the benefits of a builder aren't evident if you have only one or two controls. A builder adds syntactical convenience, which you do require for readability. There are more options for setup when adding validations and initial values, as we will see in the next section.
Read now
Unlock full access