AngularJS ng-model directive
AngularJS instance
Bind the value of the input box into the scope variable:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body><div ng-app="myApp" ng-controller="myCtrl"><input ng-model="name"><p>input The value of the input box is bound to the variable "name" :</p>{{name}}</div><script>var app = angular.module('myApp', []);app.controller('myCtrl', function($scope) { $scope.name = "John Doe";});</script><p>This example demonstrates how to use the ng-model directive to bind the value of the input box into the scope variable. </p></body></html>Definition and usage
The ng-model directive binds HTML form elements into the scope variable.
If there is no variable in scope, it will be created.
grammar
<element ng-model="name"></element>
The <input>, <select>, <textarea>, elements support this directive.
Parameter value
| value | describe |
|---|---|
| separator | The attribute name you want to bind to the form field. |
The above is a compilation of AngularJS ng-model data, and the relevant information will be added in the future.