1

I'm making an app in angular and node.js. I have a listing page where I list multiple products. When a user clicks on any product, it will go to view_product page where details of product is being shown. When Admin wants to delete a product from view_product page, then it will delete the product but when it redirects to listing page, then it does not show listing untill Admin refresh and compile whole app again. My code looks like following to redirect.

 this.router.navigate(['/listing']);

I'm fetching product in ngOnInit(). I think I need to call that method somehow when it navigates. But if I navigate from view_product page to listing using a link, then it shows products just fine. Here is how my navigation link looks like:

<li><a [routerLink]="['/listing']">Listing</a></li>

What am I missing? I need to redirect programatically from view to listing. Any help will be highly appreciated! Thanks.

Asad ullah
  • 620
  • 2
  • 9
  • 26

0 Answers0