title: AngularJS 1.2 ngInclude inside ngIf
body: <p>I'm running into some odd behavior when putting an ngInclude inside an ngIf or ngSwitch. </p>
  
  <p>For example, take the following:</p>
  
  <pre><code>&lt;button ng-click="showIncTemplate = !showIncTemplate"&gt;Toggle Included Template&lt;/button&gt;
  &lt;button ng-click="showInlineTemplate = !showInlineTemplate"&gt;Toggle Inline Template&lt;/button&gt;
  
  &lt;div ng-if="showIncTemplate"&gt;
      &lt;p&gt;Included template:&lt;/p&gt;
      &lt;div ng-include="'template.html'"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div ng-if="showInlineTemplate"&gt;
      &lt;h1&gt;Inline Template&lt;/h1&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>(<a href="http://plnkr.co/edit/gULbwnKb0gQS8DWz0V6U" rel="nofollow noreferrer">http://plnkr.co/edit/gULbwnKb0gQS8DWz0V6U</a>)</p>
  
  <p>The buttons toggle an options to render the divs that follow. The inline example behaves as expected, with the content appearing or disappearing on click. </p>
  
  <p>The div with the child include seems not to include the template when first drawn, but then includes it repeatedly on every subsequent redraw.</p>
  
  <p>What's going on here? I do see some breaking changes around ngInclude, is there some other way I should be doing this? Or is this a bug in Angular?</p>
  
  <p>Edit: </p>
  
  <p>It looks like this is already in the angularjs github issue tracker:
  <a href="https://github.com/angular/angular.js/issues/3627" rel="nofollow noreferrer">https://github.com/angular/angular.js/issues/3627</a></p>