Angular CSS classes are used for Input Form Validation. There are three sets of CSS classes:
- Ng-valid and ng-invalid just checks the input value from input fields
- Ng-touched and ng-untouched checks if the fields are focused or blurred(Events). It means that when you enter in a field and got a blinking cursor, the focus event has been triggered. On the other hand, when your cursor gets out of the field, blur event is in place.
- Ng-pristine and ng-dirty checks the field or form state.
The table below shows how Angular CSS classes are being triggered respectively. As you can see, there’s a 3-step question that is triggerred:
- All input fields will be going through this validation