Complete the code to add a required validator to the form control.
this.form = new FormGroup({ username: new FormControl('', [Validators.[1]]) });The required validator ensures the form control is not empty.
Complete the code to add a minimum length validator of 5 characters.
this.form = new FormGroup({ password: new FormControl('', [Validators.minLength([1])]) });The minLength validator requires the input to be at least the given number of characters. Here, 5 means minimum 5 characters.
Fix the error in the pattern validator to only allow digits.
this.form = new FormGroup({ code: new FormControl('', [Validators.pattern('[1]')]) });The pattern ^\\d+$ matches only digits from start to end.
Fill both blanks to create a form control with required and minimum length 8 validators.
this.form = new FormGroup({ password: new FormControl('', [Validators.[1], Validators.[2](8)]) });The required validator ensures the field is filled, and minLength(8) ensures at least 8 characters.
Fill all three blanks to create a form control with required, minLength 6, and a pattern allowing only letters.
this.form = new FormGroup({ username: new FormControl('', [Validators.[1], Validators.[2](6), Validators.[3]('^[a-zA-Z]+$')]) });The validators ensure the username is filled, at least 6 characters, and contains only letters.