Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<input type="text" ng-model="test">
<div ng-controller="ChildCtrl">
<pre>{{ test }}</pre>
</div>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope, $rootScope) {
$rootScope.name = 'Superhero';
}
function ChildCtrl($scope, $rootScope) {
$rootScope.test = '';
$rootScope.$watch('test', function(newVal, oldVal) {
alert(oldVal+" : "+newVal);
});
}