It is possible for an element within an Angular form to enter into the dirty
state without yet being touched
? I have some code in my template that, depending on the answer to this question, may be redundant.
<input class="form-control" #fName="ngModel" required />
<div *ngIf="fName.invalid && (fName.dirty || fName.touched)" class="form-error">
First name is required
</div>
This *ngIf
in this div
, for instance, could be simplified to fName.invalid && fName.touched
if there's no such thing as a dirty, untouched form control.