Check out example codes for "validation minlength angular". It will help you in understanding the concepts better.

Code Example 1

Validators.maxLength(11)

Code Example 2

Validators.minLength(9)

Code Example 3

content_copy
      
      ngOnInit(): void {
  this.heroForm = new FormGroup({
    'name': new FormControl(this.hero.name, [
      Validators.required,
      Validators.minLength(4),
      forbiddenNameValidator(/bob/i) // <-- Here's how you pass in the custom validator.
    ]),
    'alterEgo': new FormControl(this.hero.alterEgo),
    'power': new FormControl(this.hero.power, Validators.required)
  });

}

get name() { return this.heroForm.get('name'); }

get power() { return this.heroForm.get('power'); }

Learn ReactJs, React Native from akashmittal.com