<input type="*">
<select>
<textarea>
<button>
ng-model
directive binds data and it binds the input controller to the rest of an application. The following is the syntax for ng-model
directive:
[html]
<input type="text" id="name" ng-model="spForm.name">
[/html]
$scope.spForm.name
has a value set inside SPController
function, the input field will start with that value. Additionally, once the user types something into the text field, that value will be copied into the $scope.spForm.name
property. ng-model
can be used for Radio buttons that can have different values, but only the selected ones will be used.
[html]
<form>
<input type="radio" ng-model="spForm.gender" value="male">Male
<input type="radio" ng-model="spForm.gender" value="female">Female
</form>
[/html]
ng-model
directive binds the select box to the application.
Any of the options defined in the ng-model attribute can be selected in the selectbox.
[html]
<select ng-model="spTech">
<option value="">
<option value="AngularJS">Dogs
<option value="Bootstrap">Tutorials
<option value="JavaScript">Cars
</select>
[/html]