Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

How to refresh previous page after current page closes in angular 2+

  • Hi experts,
    I have a product-list page where I show list of all products. From this page there is link to open on product-new page where I add new product. After adding the product in DB I want to show newly added product in my previous product-list page after current product-new page is closed. I could not find any solution to pass newly added product back to previous page or refresh it to reload product list. Could you please help me with this.

  • So I managed to achieve what i wanted. This might not be best practice or right way of doing that, but I will stick with it till I find a better solution.

    From my product-new component, I replaced it with product-list page rather than just poping it. Doing so new product-list will be created on top of the stack with fresh data. But then there will be 2 product-list in the stack back to back. Top on with refreshed data, 2nd top with old data. Now delete the 2nd top product-list from stack and your are good now.

    Below is my code.

    this.navi.nativeElement.removePage(1); // 1 represents the index of the previous ProductListPageComponent, this will be different in your case.

    Please let me know know if there is a better way of doing that.