Angular: Empty Fiddle
http://angularjs.org/
by heavyhorse
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<input type="text" ng-model="name">
<div ng-controller="ChildCtrl">
<pre>{{ debug }}</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.debug = '';
$scope.$watch('name', function(newVal, oldVal) {
$scope.debug += " value changed...";
});
}