Reputation: 45
I need to check a value for negative 1 that I use for failure but I don't want to display that value. Instead I want to display either "N/A" or "--" but I am new to angular and not sure how. My material table is listed below. Any help would be appreciated.
<div>
<ng-container matColumnDef="Milliseconds">
<mat-header-cell *matHeaderCellDef mat-sort-header> Milli seconds </mat-header-cell>
<mat-cell *matCellDef="let latency"> {{latency.Milliseconds}} </mat-cell>
</ng-container>
</div>
Thanks in advance
Upvotes: 0
Views: 1335
Reputation: 8306
You can do this with a ternary operator:
<mat-cell *matCellDef="let latency">{{ latency.Milliseconds === -1 ? '--' : latency.Milliseconds }}</mat-cell>
Upvotes: 1