Input is an HTML tag which is used to get user input.ng-model is an angular directive which is used for data binding(i.e.,reference to the input element is provided by the ng-model). These both are combined to modify the input field.
The following states are established to the input field whose value is true for the following.
- $untouched: when the field has not been touched
- $touched: when the field has been touched
- $pristine: when the field has not been modified
- $dirty: when the field has been modified
- $invalid: when the field content is not valid
- $valid: when the field content is valid
Example: $valid state for the required input field in a form is explained below
For the above-mentioned input directive, few CSS classes are added. They are:
- ng-untouched: The field has not been touched yet
- ng-touched: The field has been touched
- ng-pristine: The field has not been modified yet
- ng-dirty: The field has been modified
- ng-valid: The field content is valid
- ng-invalid: The field content is not valid
- ng-valid-key: One key for each validation.
- ng-invalid-key: One key for each validation.
The classes are removed if the value is false.
If the input field is used along with the required attribute, valid (when there is an input it is set to true) and invalid (when there is no input it is set to true) states are established. The classes are removed if the value is false.
- AngularJS | ng-show Directive
- AngularJS | ng-init Directive
- AngularJS | ng-if Directive
- AngularJS | ng-dblclick Directive
- AngularJS | ng-keypress Directive
- AngularJS | ng-keydown Directive
- AngularJS | ng-keyup Directive
- AngularJS | ng-href Directive
- AngularJS | ng-focus Directive
- AngularJS | ng-hide Directive
- AngularJS | ng-disabled Directive
- AngularJs | ng-list Directive
- AngularJS | ng-mouseup Directive
- AngularJS | ng-mousedown Directive
- AngularJS | ng-maxlength Directive
- AngularJS | ng-minlength Directive
- AngularJS | ng-mousemove Directive
- AngularJS | ng-mouseover Directive
- AngularJS | ng-mouseleave Directive
- AngularJS | ng-mouseenter Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.