I am using mat-table and I need to add a custom icon in the mat-sort-header, but now if I click in the icon, table will be sorted and I don't want that behavior, this is the code:
<!-- line Column -->
<ng-container matColumnDef="line">
<th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>
line
<span *ngIf="lineFiltered == false; else noFilteredline" (click)="filterLine.toggle($event)" class="filter">
<i class="fa fa-filter" aria-hidden="true"></i></span>
<ng-template #noFilteredline>
<span (click)="filterLine.toggle($event)" class="filter success"
><i class="fa fa-filter" aria-hidden="true"></i
></span>
</ng-template>
</th>
<td mat-cell *matCellDef="let row">{{ row.line }}</td>
</ng-container>
this is the sort header:
If I put the icon outside of it doesn't appear.
p.s. I can't use event.stopPropagation()
