Currently, I am working on an E-commerce project. In the shop page, when a user clicks on the "View More" button for a product, I redirect them to the product details page with the specific product id.
<a [routerLink]="['/product-details', product.id]">View More</a>
Once the user is on the product page, I want to display 4 additional products from the same brand below the product details. To achieve this, I have created an API that takes the brand_id
of the current product and returns 4 random products for that brand. When the user clicks on one of these additional products, they should stay on the same page but with the new product's details like this:
<a [routerLink]="['/product-details', moreProduct.id]">View More</a>
The issue I am facing is that although the URL updates with the new product id, the content on the page does not change until I manually reload the page. How can I resolve this problem?