The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
With the ng-model
directive you can bind the value of an input field to a variable created in AngularJS.
The binding goes both ways. If the user changes the value inside the input field, the AngularJS property will also change its value:
The ng-model
directive can provide type validation for application data using attributes like:
The ng-model directive can provide status for application data (valid, dirty, touched, error):
The ng-model directive provides CSS classes for HTML elements, depending on their status: