-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex4.html
More file actions
27 lines (25 loc) · 752 Bytes
/
ex4.html
File metadata and controls
27 lines (25 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html ng-app="myApp">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.fname = "Satheesh";
/* watching the function by using console */
$scope.$watch('lname', function(newV, oldV) {
console.log('new value is ' + newV);
});
/* Timer function */
setTimeout(function(){
$scope.lname = "Aravind";
$scope.$apply();
}, 2000);
});
</script>
<body>
<div ng-controller="myCtrl">
<div>First Name: <input ng-model="fname" type="text" />{{fname}}</div>
<div>Last Name:<input ng-model="lname" type="text" />{{lname}}</div>
</div>
</body>
</html>