Thursday, September 1, 2016

Two way Binding in AngularJS

Here I will show you Two way Binding in AngularJS.


Change First and Last names inside the input fields, and the model will change automatically.
Enter First Name:
Enter Last Name:

{{firstname + " " + lastname}}

<!DOCTYPE html>
<script src=""></script>

<div ng-app="myApp" ng-controller="myController">
    Enter First Name: <input ng-model="firstname">
Enter Last Name: <input ng-model="lastname">
    <h1 style="color:green">{{firstname + " "+lastname}}</h1>

var app = angular.module('myApp', []);
app.controller('myController', function($scope) {
    $scope.firstname = "Vara";
    $scope.lastname = "Reddy";