Angularjs Examples

AJS Examples


AngularJS ng-Model Directive

The AngularJS ng-model directive is used to bind an input,select, textarea etc elements with model property.

Syntax

<div ng-model="siteName"></div>

AngularJS ng-Model Directive Example

<html>
<head>
<title>My first AngularJS ng-model Directive code</title>
<Script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">
</Script>
<Script>
//Defining Controller Using Standard Javascrip Object Constructor
function CustomerController($scope) {
	$scope.name = "Jimi Scotts";
	$scope.address = "12-13-283/A1";
	$scope.email = "jimi@yahoo.com";
}
</Script>
</head>
<body>
<div ng-app="">
<div ng-controller="CustomerController"> 

<input type="text" ng-model="name"> </br>
<input type="text" ng-model="address">   </br>
<input type="text" ng-model="email">   

</div>
</div>
</body>
</html>
See Live Example