I have one controller which is nested into another
<div id="divTest" ng-controller="TestCtrl">
{{test}}
<div ng-controller="InnerTestCtrl">
{{innerTest}}
</div>
</div>
When I tried to change a scope value into an inner controller after 3 seconds it was failed. Could you please explain why and how reach this behavior (I mean that value will be changed, in example from 1 to 2)?
var app = angular.module("TestApp", []);
app.controller("TestCtrl", function($scope)
{
$scope.test = "a";
});
app.controller("InnerTestCtrl", function($scope)
{
$scope.innerTest = "1";
window.setTimeout(function()
{
$scope.innerTest = "2";
}, 3000);
});
angular.bootstrap(document.getElementById("divTest"), ["TestApp"]);
example in jsfiddle