title: How to pass ngFor index in ngClass
body: <p>I'm trying to pass the ngFor with index inside ngClass to activate the correct class. I have tried different ways, but I have not been successful.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;td *ngFor="let cell of row; let i = index" [ngClass]="{'col-tb-1-active' : classFocus.col1 , 'col-tb-1' : !classFocus.col1}"&gt;{{ cell.value }}&lt;/td&gt;
  </code></pre>
  
  <p>In this case, where it has "1", I want to change the index. Would be something like:</p>
  
  <pre><code>&lt;td *ngFor="let cell of row; let i = index" [ngClass]="{'col-tb-1-active' : classFocus.col1 , 'col-tb-1' : !classFocus.col1}"&gt;{{ cell.value }}&lt;/td&gt;
  </code></pre>
  
  <p>I tried it that way, but it did not work:</p>
  
  <pre><code>&lt;td *ngFor="let cell of row; let i = index" [ngClass]="{'col-tb-' + i + '-active' : 'classFocus.col' + i , 'col-tb-' + i : !'classFocus.col'+ i}"&gt;{{ cell.value }}&lt;/td&gt;
  </code></pre>