Angular Forms | angularjs w3c
FormsinAngularJSprovidesdata-bindingandvalidationofinputcontrols.InputControlsInputcontrolsaretheHTMLinputelements:inputelementsselectelementsbuttonelementstextareaelementsData-BindingInputcontrolsprovidesdata-bindingbyusingtheng-modeldirective.
Forms in AngularJS provides data-binding and validation of input controls.
Input ControlsInput controls are the HTML input elements:
input elements select elements button elements textarea elements Data-BindingInput controls provides data-binding by using the ng-model directive.
<input type="text" ng-model="firstname">
The application does now have a property named firstname.
The ng-model directive binds the input controller to the rest of your application.
The property firstname, can be referred to in a controller:
Example<script>var app = angular.module(myApp, []);app.controller(formCtrl, function($scope) { $scope.firstname = "John";});</script>
Try it Yourself »[1]It can also be referred to elsewhere in the application:
CheckboxA checkbox has the value true or false. Apply the ng-model directive to a checkbox, and use its value in ...