How to update the data after pop page in ionic3?


#1

hello,
i have to implemented the delete product functionality in which after deted product page is pop and trigger parent page function i used ionViewWillEnter but its not trigger the function tell m anyone how to trigger after pop?

page 2 > self.navCtrl.pop(); and in the page 1 using>
	// It’s fired when entering a page
	ionViewWillEnter() {
	  this.getAllProductViaCategory();
    }

#2

ionViewDidLoad is your friend then


#3

sir its not working for me
?


#4
Page Event Returns Description
ionViewDidLoad void Runs when the page has loaded. This event only happens once per page being created. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The ionViewDidLoad event is good place to put your setup code for the page.
ionViewWillEnter void Runs when the page is about to enter and become the active page.
ionViewDidEnter void Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page.
ionViewWillLeave void Runs when the page is about to leave and no longer be the active page.
ionViewDidLeave void Runs when the page has finished leaving and is no longer the active page.
ionViewWillUnload void Runs when the page is about to be destroyed and have its elements removed.
ionViewCanEnter boolean/Promise Runs before the view can enter. This can be used as a sort of “guard” in authenticated views where you need to check permissions before the view can enter
ionViewCanLeave boolean/Promise Runs before the view can leave. This can be used as a sort of “guard” in authenticated views where you need to check permissions before the view can leave

taken from : https://ionicframework.com/docs/api/navigation/NavController/


#5

use ionViewDidEnter. it will help you


#7

Not that you have any reason to care about my opinion, but I think this is an absolutely horrendous idea. It shatters separation of concerns. What I would do instead is to have a single service provider store the canonical version of the data that is displayed and modified by various pages, exposing it as an Observable. That way, parentPage will be subscribed to that Observable and automatically receive the updated information.

Additionally, this kludge will not scale to Ionic 4, because the Angular router frowns on passing anything except scalar values as parameters.