AngularJS Example:

by sunnycpp

HTML

<div ng-app="ctrl">
    <h2>Test</h2>
  <div ng-controller="TodoCtrl">
     <div ng-repeat="log in logs">
         <p>{{log}}</p>
     </div>
  </div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<style>
.done-true {
  text-decoration: line-through;
  color: grey;
}

JavaScript

var ctrl = angular.module('ctrl',[]);

function TodoCtrl($scope) {
  	var scope = $scope;
    var logs = scope.logs = [];
    
    scope.name = 'misko';
	scope.counter = 0;
 
	scope.$watch('name', function(newValue, oldValue) {
        scope.counter = scope.counter + 1
        logs.push("In Name change, counter:" + scope.counter);        
	});
    logs.push("Before first digest");
    scope.$digest();
    logs.push("After first digest");
	scope.name = 'adam';
	logs.push("Before second digest");
    scope.$digest();
    logs.push("After second digest");  
}