What is Two way Data binding in AngularJS?
One of the Core Feature of AngularJS which makes it popular is two way data binding. In two way data binding, any changes to the model are immediately reflected in the View and any changes in the View updates the model.
Example:One of the Core Feature of AngularJS which makes it popular is two way data binding. In two way data binding, any changes to the model are immediately reflected in the View and any changes in the View updates the model.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Script/angular.js"></script>
<script type="text/javascript">
var myApp = angular.module('myApp', [])
.controller('myController', function ($scope) {
$scope.name = "Anoop";
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="myController">
Enter Name:<input type="text" ng-model="name" />
<p>Hello! {{name}}
</div>
</body>
</html>
|
Preview:
I hope you like it.Thanks.
[Download Source Code via Google Drive]