Take the 2-minute tour ×  I'm looking into chaining promises to
populate my scope, and then having the scope automatically
update the dom.  I'm running into problems with this though.. If
I call "then" on an already resolved promise, it creates a new
promise (that will call the success function asynchronously but
almost immediately). I think the problem is that we've already
left the digest cycle by the time the success function is
called, so the dom never updates.  Here is the code:  <div ng-
controller="MyCtrl">     Hello, {{name}}! <br/>     <button ng-
click="go()">Clickme</button><br/>   function MyCtrl($scope, $q)
{     var data = $q.defer();         setTimeout(function()
{$scope.$apply(data.resolve("Some Data"))}, 2000);     var p =
data.promise;      $scope.name = p.then(angular.uppercase);
$scope.name2 = p.then(function(x) { return "Hi "+x;});
$scope.go = function() {             $scope.name3 =
p.then(function(x) {                  // uncomment this to make
it work:                 return "Fina