Complete the code to create a new FormControl with an initial value of an empty string.
const nameControl = new FormControl([1]);The FormControl constructor takes the initial value as its first argument. An empty string '' initializes the control with no text.
Complete the code to import FormControl from Angular's forms package.
import { [1] } from '@angular/forms';
FormControl is imported from '@angular/forms' to create individual form controls.
Fix the error in the code by completing the blank to get the current value of the FormControl named 'emailControl'.
const emailValue = emailControl.[1];The value property of a FormControl holds its current value. Methods like setValue() are for setting, not getting.
Fill both blanks to create a FormControl with an initial value 'hello' and a required validator.
const greetingControl = new FormControl([1], [2]);
The first argument is the initial value, here the string 'hello'. The second argument is the validator function, here Validators.required to make the field mandatory.
Fill all three blanks to create a FormControl with initial value '', a required validator, and a minimum length validator of 5.
const passwordControl = new FormControl([1], [[2], [3]]);
The initial value is an empty string ''. The validators are passed as an array: Validators.required ensures the field is not empty, and Validators.minLength(5) ensures at least 5 characters.