title: ngFor: different color for odd/even rows when loop is in ng-container
body: <p>I have a table in which I'd like to give the odd and even rows a different background color. Normally, you can use the <code>odd</code> and <code>even</code> variables for this. However, I'm now building up my table rows inside an <code>ng-container</code> so I can conditionally create one or more rows per iteration. In this case, every iteration creates 1 or 2 rows, depending on a variable.</p>
  
  <pre><code>&lt;ng-container *ngFor="let detailof data.details; let odd = odd;"&gt;
      &lt;tr [ngClass]="{ 'k-alt': odd}"&gt;
          &lt;td&gt;
              {{ detail.number1 }}
          &lt;/td&gt;
          &lt;td&gt;
              {{ detail.number2 }}
          &lt;/td&gt;
          &lt;td&gt;
              {{ detail.number3 }}
          &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr *ngIf="detail.conditionalVariable" [ngClass]="{ 'k-alt': odd}"&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;{{ detail.conditionalVariable }}&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
  
      &lt;/tr&gt;
  &lt;/ng-container&gt;
  </code></pre>
  
  <p>As you can see, every iteration will cause the rows to be marked with a different background and not every row itself because the odd variable is declared in the <code>*ngFor</code> in the <code>ng-container</code> element.</p>
  
  <p>Is there a way to give each row a different background color when using <code>ng-container</code> with conditional rows?</p>