How to include or exclude an attribute from the HTML in Angular 4
Well, I solved it as follow:
<mat-header-cell *matHeaderCellDef [mat-sort-header]=" column!='actions' ? column : null " [disabled]=" column=='actions' ? true : false " >
Needed to bind the disabled
property.
CoderX's answer is the best approach for your question. but there might come a scenario where you need to render a separate template based on condition. In such a case you can do it like below:
<ng-container *ngIf="columnAction=='sort'; else noSort">
<mat-header-cell *matHeaderCellDef mat-sort-header />
</ng-container>
<ng-template #noSort>
<mat-header-cell *matHeaderCellDef />
</ng-template>