title: How to include or exclude an attribute from the HTML in Angular 4
body: <p>I am using angular 4 with angular materials to construct a table.
  I want the <code>mat-sort-header</code> to be added conditionally on the following template. </p>
  
  <pre><code>&lt;mat-header-cell *matHeaderCellDef mat-sort-header&gt;Id&lt;/mat-header-cell&gt;
  </code></pre>
  
  <p>I have tried the following code:  </p>
  
  <pre><code>&lt;mat-header-cell *matHeaderCellDef [mat-sort-header]=" column!='id' ? column : false "&gt;Id&lt;/mat-header-cell&gt;
  </code></pre>
  
  <p>But it still adds the sorting header in the table for this column.</p>
  
  <p>My overall table looks as follows, and is working fine, except for the sorting header issue:  </p>
  
  <pre><code>  &lt;mat-table #table1 [dataSource]="records" matSort class="mat-cell"&gt;
  
      &lt;ng-container *ngFor="let column of keys" [matColumnDef]="column"&gt;
        &lt;mat-header-cell *matHeaderCellDef [mat-sort-header]=" column!='actions' ? column : false "&gt;
          &lt;p *ngIf=" column!='actions' "&gt;{{ column }}&lt;/p&gt;
          &lt;button *ngIf=" column=='actions' " mat-icon-button color="primary" (click)="functionA()"&gt;
            &lt;mat-icon class="indigo-icon" aria-label="Example icon-button with a heart icon"&gt;add&lt;/mat-icon&gt;
          &lt;/button&gt;
  
        &lt;/mat-header-cell&gt;
        &lt;mat-cell *matCellDef="let row; let i=index;"&gt;
          &lt;p *ngIf=" column!='actions' "&gt;{{ row[column] }}&lt;/p&gt;
          &lt;button *ngIf=" column=='actions' " mat-icon-button color="accent" (click)="functionA()"&gt;
            &lt;mat-icon class="indigo-icon" aria-label="Edit"&gt;edit&lt;/mat-icon&gt;
          &lt;/button&gt;
  
          &lt;button *ngIf=" column=='actions' " mat-icon-button color="accent" (click)="functionA()"&gt;
            &lt;mat-icon class="indigo-icon" aria-label="Delete"&gt;delete&lt;/mat-icon&gt;
          &lt;/button&gt;
  
        &lt;/mat-cell&gt;
      &lt;/ng-container&gt;
  
      &lt;mat-header-row *matHeaderRowDef="keys"&gt;&lt;/mat-header-row&gt;
      &lt;mat-row *matRowDef="let row; columns: keys;"&gt;&lt;/mat-row&gt;
    &lt;/mat-table&gt;
  </code></pre>