Validation

Learn how to add validation to an input.

The next thing we’ll look at is adding validation to our form. Template forms use HTML5 attributes to determine if an input should be validated. This is called constraint validation. You can find more information about it here.

Adding constraint attributes

There’s a section on the page called Validation-related attributes. This is a list of attributes we can apply to the <input> element to perform validation. Let’s update the <input> element in the app.component.html template file.

Get hands-on with 1200+ tech skills courses.