title: How to Implement *matCellDef and *ngif on the Same Cell
body: <p>I originally created a static HTML table where I set a formula and css based on the value in the cell:</p>
  <pre><code>&lt;td *ngIf=&quot;r.Num_Of_Days !== 0 &quot;(click)=&quot;getCTData(r.Name,'Num_Of_Days','high')&quot; class=&quot;rd&quot;&gt;
      {{r.Num_Of_Days}}
  &lt;/td&gt;
  &lt;td *ngIf=&quot;r.Num_Of_Days === 0 &quot;&gt;&lt;/td&gt;
  </code></pre>
  <p>I had to change to using Angular Material since the column names will be dynamic and I had to use the columnstodisplay directive to identify which columns to show. I tried using *matCellDef and *ngIf in the  but it threw an error. I did some searching and saw that I needed to use &lt;ng-container, so I came up with the following:</p>
  <pre><code>&lt;td mat-cell *matCellDef=&quot;let r&quot;&gt;
      &lt;ng-container *ngIf=&quot;r.Num_Of_Days !== 0;else conditionNotMet&quot; 
         (click)=&quot;getCTData(r.Name,'Num_Of_Days','high')&quot; class=&quot;rd&quot;&gt;
          {{r.Num_Of_Days}}
      &lt;/ng-container&gt;
  &lt;/td&gt;
  &lt;ng-template #conditionNotMet&gt;&lt;/ng-template&gt;
  </code></pre>
  <p>This populates the data ok, BUT it doesn't apply the function or the css to the cell. How can I get the css and function applied correctly so that when the value is 0 there is no click event and the cell is not colored AND if the value is greater than 0 than the function and formatting are applied?</p>