When we freshly enter into this page A the event is fired and the back button works as expected.
Let’s open up again page A, and from this page we show the model page B using the ModalController.present.
If we dismiss now page B (shown modal), the event onViewWillEnter is not being fired anymore while re-entering page A, but also the back button is not working anymore.
Accoring the ionic docs the event should be fired as page A becomes active again:
ionViewWillEnter void Runs when the page is about to enter and become the active page.
From my point of this sFrom my point of view this is a bug.
Or can someone explain this behaviour? What do you think?
I believe the behavior is correct, even if it’s a little confusing at first. Page A is still the current page, even while Modal B is open, as Modal B isn’t a true page. It’s still declared a page, and is conceptually a page, but it isn’t a page in the same sense that Page A is a page. Instead, it’s a “page” that is overlayed across Page A.
I’m fairly certain this is the case, but there is of course always the possibility that I’m wrong.
@SigmundFroyd: I could agree on that, but then the concept does not follow a red line. If so, the hw button should still be registered, even after coming back from a modal window…
Sorry, @SigmundFroyd is right and I’m wrong. I went back and looked, and ionViewWillEnter fires inside the modal when the modal enters. In the base page, when you present a modal, you don’t leave the base page, so ionViewWillLeave() doesn’t fire in the base page even though ionViewWillEnter() fires inside the modal. I had assumed that the one implied the other and it doesn’t.
Hey, did someone figure this out? I am also looking for an event/method that fires each time a page becomes the primary shown one (like viewDidAppear in iOS for example). My problem is when the app is in the background and I click on a local notification which brings the app forward, but neither the ionViewDidLoad, ionViewWillEnter or ionViewDidEnter fire. Btw, I am using side-menu, if that makes a difference.
I need to call ionContent.resize when my login modal closes because the header/footer are dependent on user type. Unfortunately, since ionViewWillEnter, this isn’t working…
edit: since the data was changing on login, what I really needed to do was to use a ReplaySubject to listen for the loaded data and then trigger the ioncontent.resize method.