title: Angular's $rootScope#$digest
body: <p>Reading this excellent book (<a href="http://www.packtpub.com/angularjs-web-application-development/book" rel="nofollow">Mastering Web Development in AngularJS</a>), I ran across this code:</p>
  
  <pre><code>var Restaurant = function ($q, $rootScope) {
  
  var currentOrder;
  
  this.takeOrder = function (orderedItems) {
      currentOrder = {
      deferred:$q.defer(),
      items:orderedItems
  };
      return currentOrder.deferred.promise;
  };
  this.deliverOrder = function() {
      currentOrder.deferred.resolve(currentOrder.items);
      $rootScope.$digest();
  };
  this.problemWithOrder = function(reason) {
      currentOrder.deferred.reject(reason);
      $rootScope.$digest();
  };
  </code></pre>
  
  <p>My understanding is that the <code>$rootScope.$digest();</code> calls are made in order to alert Angular that the <code>Promise</code>'s state has been updated.</p>
  
  <p>Is my understanding correct? Also, is it necessary to make the above <code>$rootScope.$digest();</code> calls?</p>