Complete the code to create a form group using FormBuilder.
this.form = this.formBuilder.[1]({ name: [''], age: [''] });
The group method of FormBuilder creates a new form group.
Complete the code to inject FormBuilder into the component constructor.
constructor(private [1]: FormBuilder) {}By convention, the FormBuilder service is injected with the name formBuilder.
Fix the error in the code to add a required validator to the 'email' control.
this.form = this.formBuilder.group({
email: ['', [1]]
});The Validators.required is a property, not a function call, so no parentheses are needed.
Fill both blanks to create a form group with a 'username' control that is required and has a minimum length of 5.
this.form = this.formBuilder.group({
username: ['', [[1], [2]]]
});Use Validators.required and Validators.minLength(5) together to enforce both rules.
Fill all three blanks to create a form group with 'password' and 'confirmPassword' controls, both required, and add a custom validator named 'passwordMatch'.
this.form = this.formBuilder.group({
password: ['', [1]],
confirmPassword: ['', [2]]
}, { validators: [3] });Both controls need validators in arrays. The group-level validator is the custom passwordMatch function.