I am currently learning angularJS and read about ng-pristine and ng-untouched directives for angular forms.
I am having trouble conceptually differentiating between these two directives, to me they seem to be one and the same by their definition.
For reference, here is how angular defines these directives: ng-untouched: the control hasn't been blurred ng-pristine: the control hasn't been interacted with yet
With my logic, I think that an element that is untouched implies that it is an element that is pristine and vice versa. This is mostly because usually the only type of interaction I have programmed with form elements have been blurs.
What are some other types of "interactions" that one could imagine for a form control other than blurring it?
Suppose you have a text field in your form and you navigate through it using your tab key. As soon as you leave the field, it's not untouched anymore. But since you haven't entered or removed any character in the field, it's still pristine. The other types of interaction are the main ones: entering a value, select an option, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With