Forms in AngularJS provides data-binding and validation of input controls.
Input controls are the HTML input elements:
Input controls provides data-binding by using the ng-model directive.
<input type="text" ng-model="firstname">
The application does not initially have a property named firstname
.
The ng-model
directive binds the input controller to the rest of your application.
Once bound, the property firstname
can be referred to inside a controller:
A checkbox has the value true
or false
.
Apply the ng-model
directive to a checkbox, and use its value in your application.
Bind radio buttons to your application using the ng-model
directive.
Radio buttons with the same ng-model
can have different value
s, but only the selected one will be used.
First Name:
Last Name: