Can you give an example of built-in validators?

In reactive forms, you can use built-in validator like required and minlength on your input form controls. For example, the registration form can have these validators on name input field

this.registrationForm = new FormGroup({
name: new FormControl(this.hero.name, [Validators.required, Validators.minLength(4)]),
});

Whereas in template-driven forms, both required and minlength validators available as attributes.


Author of content
Edit this page

Made by Michael Sakhniuk

Twitter