Angular · Junior · Question 47 of 75
How do you show a validation error only after the user has touched the field?
- ✓Correct answer: Check
control.invalid && control.touched(ordirty) before showing the message - 2Errors are always hidden until the form is submitted, nothing to do
- 3Use the
| errorpipe
Explanation
Controls track touched (blurred), dirty (changed) and errors (e.g. { required: true }). Showing errors right away on an untouched field is annoying for users.