Latest web development tutorials

AngularJS ng-model directive

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

Binding values ​​into the input box scope variables:

<Div ng-app = "myApp " ng-controller = "myCtrl">
<Input ng-model = "name ">
</ Div>

<Script>
var app = angular.module ( 'myApp', []);
app.controller ( 'myCtrl', function ($ scope) {
$ Scope.name = "John Doe";
});
</ Script>

try it"

Definition and Usage

ng-model directive bound HTML form elements to scope variables.

If the scope of the variable does not exist, it will be created.


grammar

<Element ng-model = "name "> </ element>

<Input>, <select>, <textarea>, elements support this instruction.


Parameter Value

value description
separator You want to bind to the property name form fields.

AngularJS Reference Manual AngularJS Reference Manual