Weird Angular exception: [$rootScope:inprog] null already in progress
<p>I get a very strange exception with AngularJS 1.5.9</p>

<blockquote>
  <p>[$rootScope:inprog] null already in progress</p>
</blockquote>

<p>Here is the source code where this exception is thrown:</p>

<pre><code>function beginPhase(phase) {
  if ($rootScope.$$phase) {
    throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
  }

  $rootScope.$$phase = phase;
}
</code></pre>

<p><em>beginPhase()</em> is called with "$apply" or "$digest".</p>

<p>My question is:</p>

<ul>
<li>How is it possible to enter the "if" while <em>$rootScope.$$phase</em> is null?</li>
</ul>

<p>Any help will be appreciated.</p>