title: Declare variable in ngFor
body: <p>in my angular2 project I need to present a matrix.
  This is my current code:</p>
  
  <pre><code>&lt;tr *ngFor="let worker of workers"&gt;
      &lt;td class="{{worker.fired ? 'fired-worker':''}}"&gt;{{worker.lastName}}&lt;br&gt;{{worker.firstName}}&lt;/td&gt;
      &lt;td *ngFor="let course of courses;" class="sk-table-sub-header"&gt;
  
          &lt;div *ngIf="course.isGeneric"&gt;
              &lt;div class="col-xs-6" sc-dc [sc-dc-date]="matrix[worker.id][course.id].expiration"&gt;
                  &lt;date-picker (onDateChanged)="onDateChanged($event, worker, course, 'genericStartDate')" [date]="matrix[worker.id][course.id].genericStartDate&gt;&lt;/date-picker&gt;
              &lt;/div&gt;
              &lt;div class="col-xs-6 training-table-rounded-cell" sc-dc [sc-dc-date]="matrix[worker.id][course.id].expiration"&gt;
                  &lt;date-picker (onDateChanged)="onDateChanged($event, worker, course, 'expiration')" [date]="matrix[worker.id][course.id].expiration" &gt;&lt;/date-picker&gt;
              &lt;/div&gt;                    
          &lt;/div&gt;
          ...
  </code></pre>
  
  <p>As you can see I use <code>matrix[worker.id][course.id].expiration</code> multiple times.
  I try to avoid that declaring a variable like this:</p>
  
  <pre><code> &lt;td *ngFor="let course of courses; let item = matrix[worker.id][course.id]" ...&gt;
  </code></pre>
  
  <p>But I get a parse error:</p>
  
  <pre><code> Parser Error: Unexpected token [, expected identifier, keyword, or string at column 44 in [ngFor let course of courses; let i = matrix[worker.id][course.id]] in TrainingPlanComponent@44:20 ("r.fired ? 'fired-worker':''}}"&gt;{{worker.lastName}}&lt;br&gt;{{worker.firstName}}&lt;/td&gt;
  </code></pre>
  
  <p>Is there a way to achieve my intent?</p>
  
  <p>Thanks a lot</p>