September 2017
Intermediate to advanced
450 pages
11h 24m
English
When we invoked ngModel as the means to bind data between our input and our component properties. We also get an additional layer of functionality to look into the state of that data. Angular gives us the following three different input states we can check for:
| State | Class if true | Class if false |
| The input has been touched | ng-touched | ng-untouched |
| The input has changed | ng-dirty | ng-pristine |
| The input is valid | ng-valid | ng-invalid |
We can directly inspect these states of our input data by getting a local reference to it in our template.
#title="ngModel"
This local reference maintains a relationship with our ngModel form, and we can use it to inspect for validations states to use in other directives. For example, the ...
Read now
Unlock full access