Two-way data binding is when the model changes, the view reflects the change, and vice versa. When we have more than one html element bound to the same model variable.HTML element that can both change and display the value of the variable. Two-way bindings in AngularJS are created with the ng-model directive.
Step 1: Make a AngularJS module and controller.
- var app=angular.module("myApp", [])
- app.controller("myCtrl" ,function($scope) {
- $scope.firstName = "virendra";
- $scope.lastName="Gour";
- });
- <div ng-app="myApp">
- <div ng-controller="myCtrl">
- <input type="text" ng-model="firstName">
- <input type="text" ng-model="lastName">
- <br />
- <span ng-bind="firstName"></span>
- <span ng-bind="lastName"></span>
- </div>
- </div>


Jacob RobinsonPosted Jun 30, 2015, 3:23 AM
Nice One..