I have a mat-table
in which I pass some data and build out the table using Angular Material's table component. For some reason when I use *ngif="{{Participant,status != 1}}"
to show/hide a button, it errors.
Here is my code for the td
cell:
<td mat-cell *matCellDef="let Participant">
<button mat-button [matMenuTriggerFor]="participantStatusMenu" class="participantStatusBtn">
<span>
{{Participant.status | participantStatus}}
<fa-icon [icon]="['fas', 'angle-down']" size="lg"></fa-icon>
</span>
</button>
<mat-menu #participantStatusMenu="matMenu" class="participantStatusMenu">
<button *ngIf="{{Participant.status != 1}}" mat-menu-item>{{1 | participantStatus}}</button>
<button mat-menu-item>{{2 | participantStatus}}</button>
<button mat-menu-item>{{3 | participantStatus}}</button>
</mat-menu>
</td>
You need to remove the annotation {{}} when you are using *ngIf
<button *ngIf="Participant.status !== '1'" mat-menu-item>{{1 | participantStatus}}</button>