How to include or exclude an attribute from the HTML in Angular 4
问题 I am using angular 4 with angular materials to construct a table. I want the mat-sort-header to be added conditionally on the following template. <mat-header-cell *matHeaderCellDef mat-sort-header>Id</mat-header-cell> I have tried the following code: <mat-header-cell *matHeaderCellDef [mat-sort-header]=" column!='id' ? column : false ">Id</mat-header-cell> But it still adds the sorting header in the table for this column. My overall table looks as follows, and is working fine, except for the