title: Angular Material Table Apply Class based on [dataSource]
body: <p>I have built an Angular Material Table and would like to use class <code>error-text</code> if the [dataSource] returns isActive=false.</p>
  <p>I'm trying to do this with no luck:</p>
  <pre><code>&lt;table
    mat-table
    [dataSource]=&quot;dataSource&quot;
    matSort
    class=&quot;mat-elevation-z8 table table-striped&quot;
    [ngClass]=&quot;dataSource?.isactive == 'false' ? 'error-text' :''&quot;
  &gt;
  </code></pre>
  <p>My class isn't applied to the table.</p>
  <p>I understand that I can apply this class to each row of my table, but this seems like the incorrect solution to me:</p>
  <pre><code>&lt;ng-container matColumnDef=&quot;fullname&quot;&gt;
      &lt;th mat-header-cell *matHeaderCellDef mat-sort-header&gt;
        {{ translate(&quot;name&quot;) }}
      &lt;/th&gt;
      &lt;td
        mat-cell
        *matCellDef=&quot;let element&quot;
        [ngClass]=&quot;element?.isactive == 'false' ? 'error-text' :''&quot;
      &gt;
        {{ element.fullname }}
      &lt;/td&gt;
    &lt;/ng-container&gt;
  </code></pre>
  <p>Has anyone found a solution where I can simply state the ngClass once and it is applied to the whole table?</p>