title: *ngIf and local template variables
body: <p>Could someone please explain what's behind the following behavior?</p>
  
  <p>Say we have an Angular 2 component that has a <code>_model</code> object. Then in the template we have this:</p>
  
  <pre><code>&lt;form&gt;
      &lt;input type="text" class="form-control" required [(ngModel)]="_model.firstName" ngControl="test2"  #myInput &gt;
      &lt;br&gt;Class: {{myInput?.className}}
  &lt;/form&gt;
  </code></pre>
  
  <p>The <code>_model</code> is available from the beginning being created from scratch in <code>ngOnInit()</code>. The input field is properly populated with the <code>_model.firstName</code> variable and the line:</p>
  
  <p><code>&lt;br&gt;Class: {{myInput?.className}}</code> </p>
  
  <p>correctly renders the following in the template:</p>
  
  <p><code>Class: form-control ng-untouched ng-pristine ng-invalid</code>.</p>
  
  <p>So far so good. What confuses me is that the moment I add <code>*ngIf</code> and I change the input field to </p>
  
  <pre><code>&lt;input *ngIf="_model" type="text" class="form-control" required [(ngModel)]="_model.firstName" ngControl="test2"  #myInput &gt;
  </code></pre>
  
  <p>The double curly braces interpolation stops working because apparently the local <code>myInput</code> variable doesn't get initialized even when nothing else in the code changes, the <code>_model object</code> is still created in <code>onNgInit()</code> and the input field is still working properly. The only thing that the <code>{{myInput?.className}}</code> renders is</p>
  
  <p><code>Class:</code></p>
  
  <p>Can someone explain what's going on and/or point me to the correct piece of documentation for this?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here's a <a href="http://plnkr.co/edit/itNRpy5lc9PB837C7HdP?p=preview" rel="nofollow noreferrer">Plunker</a> that shows the issue in question.</p>
  
  <p>Created bug report <a href="https://github.com/angular/angular/issues/8087" rel="nofollow noreferrer">https://github.com/angular/angular/issues/8087</a></p>