I learned from this post that angular resolved promises cannot execute their 'then' function until next digest cycle: Angular JS: Chaining promises and the digest cycle
Code of that original question is here http://jsfiddle.net/QZM4d
But there is something about the answer to that post I don't understand. First, why clicking a button that does nothing in its ng-click trigger a digest cycle, while clicking the original ng-click="go" button a second time does not trigger a digest cycle?
Second, if I remove the $scope.$apply wrapper in the setTimeout call like this:
setTimeout(function() {data.resolve("Some Data")}, 2000);
Then clicking "Click me" button after 2 seconds would cause all three names to be displayed correctly, why?
I somehow suspect it's because angular does not trigger digest cycle if no value has changed, but couldn't explain why the second time I click that "Click me" button would not change the value of name3.