I am currently working on an Angular app that displays orders using the *ngFor directive. Each order has a datetime field indicating the date it was created. My goal is to implement a timer that shows how long a customer has been waiting for their order in minutes, by calculating the difference between the order creation time and the current time. I attempted to use the amDifference pipe, but it displayed the same output for all records. While it would be straightforward to do this for a single item, I am unsure how to achieve this within the *ngFor loop.
<mat-card class="order-card" *ngFor="let order of orders?.orders">
<mat-card-subtitle>
Customer Name: {{ order.customerName }}
</mat-card-subtitle>
<mat-card-subtitle>
Table Number: {{ order.tableNumber }}
</mat-card-subtitle>
<mat-card-subtitle>
Food: {{ order.food }}
</mat-card-subtitle>
<mat-card-subtitle>
Drink: {{ order.drink }}
</mat-card-subtitle>
<mat-card-subtitle>
Estimated Wait Time: {{ order.waitTime }} minutes
</mat-card-subtitle>
<mat-card-subtitle>
Actual wait time: <!-- this is where I want to display dynamic time difference between now and order.time -->
</mat-card-subtitle>
<button mat-button class="delete-button" color="primary" (click)="deleteOrder(order.orderId)">Remove Order</button>
</mat-card>