TutorialLesson 19Free preview
AngularJS Validation
This lesson is part of AngularJS · All levels
Summary
AngularJS validation works automatically thanks to attributes on inputs such as required, type=email, and minlength. AngularJS automatically adds CSS classes (valid, invalid, dirty, touch) so you can easily give red/green. The error message can be displayed by checking the $error property.
Key points
- HTML-inbuilt attributes such as required and type=email are used for validation
- Automatic classes: invalid, invalid, dirty, touched
- The $error property contains a list of rules that were violated
- Display messages only after the field is touched to make UX better
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.