title: How does $scope.apply() work exactly in AngularJS?
body: <p>I often updated model variables corresponding to DOM expression ({{}}) within the controllers. e.g. </p>
  
  <pre><code>$scope.myVar = new_value;
  </code></pre>
  
  <p>Some times the corresponding DOM expression <strong>{{myVar}}</strong> is updated automtically, others it's not.</p>
  
  <p>I understand that sometimes we need to call <strong>$scope.$apply</strong> but...</p>
  
  <ul>
  <li><p>I don't understand <strong>when</strong> I should call it</p></li>
  <li><p>Some times I call it (let's say, just to be "sure") but I get this error (I guess since it's already being executed):</p></li>
  </ul>
  
  <blockquote>
    <p>Error: [$rootScope:inprog]
    <a href="http://errors.angularjs.org/1.3.6/" rel="nofollow">http://errors.angularjs.org/1.3.6/</a>$rootScope/inprog?p0=%24digest</p>
  </blockquote>
  
  <p>Any clue?</p>