I am currently working with a list that utilizes an *ngFor loop in the template:
<li *ngFor="let product of products | filterProducts: selectedFilter; index as productId">
<a [routerLink]="['/product', productId]">
{{product.name}}
</a>
</li>
While using the filterProducts pipe to sort array items based on selected options, I've encountered an issue where the productId in the template does not update when the array changes. As a result, the routerLink ends up directing me to incorrect details pages (as it still references the original productId).
Does anyone have any suggestions for solving this? Ideally, I would like the productId in the template to be updated each time I filter items in the array.