title: Passing ngFor variable to an ngIf template
body: <p>How do I pass the current variable in an ngFor loop to ngIf, if it is using templates with then/else syntax?</p>
  
  <p>It appears that they pass through fine when used inline, but aren't accessible from a template, for example:</p>
  
  <pre><code>&lt;ul *ngFor="let number of numbers"&gt;
    &lt;ng-container *ngIf="number % 2 == 0; then even_tpl; else odd_tpl"&gt;&lt;&gt;/ng-container&gt;
  &lt;/ul&gt;
  
  
  &lt;ng-template #odd_tpl&gt;
    &lt;li&gt;Odd: {{number}}&lt;/li&gt;  
  &lt;/ng-template&gt;
  
  &lt;ng-template #even_tpl&gt;
    &lt;li&gt;Even: {{number}}&lt;/li&gt;  
  &lt;/ng-template&gt;
  </code></pre>
  
  <p>The templates don't seem to have access to <code>number</code> at all, but it works if used inline.</p>
  
  <p>A full example of the working and not-working versions in the following link: <a href="https://embed.plnkr.co/yyM6ew/" rel="noreferrer">plunkr</a></p>