Search This Blog


Angular JS Tutorial8: $digest and $watch

$digest() is useful when we want to hook up a vanilla javascript in angularjs.

When you create a data binding from somewhere in your view to a variable on the $scope object, AngularJS creates a "watch" internally. A watch means that AngularJS watches changes in the variable on the $scope object. The framework is "watching" the variable. Watches are created using the $scope.$watch() function

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

 <script type="text/javascript">
  var application=angular.module('myapp',[]);
      alert('You reach at 5');
<body ng-app="myapp" ng-controller="mycontroller">
 <input type="button" value="Generate Random Number"/>

No comments: