Nav.push - previous page always running


#1

Hi

I wonder if this is the expected feature:

  • Page 1: with video, video is playing in iframe.
  • I “nav.push” to page 2
  • Page 2 is loaded, and video of page 1 is still playing.

I fixed the problem, but it means that the " Pushed" pages are still active ?

With Ionic V2 beta 10


#2

How you fixed it? I have same problem on my project.

Regards


#3

I do not know if it can help you:

I had:
Master Page 1 => 1 DetailsPage => DetailsPage2
masterPage1 push detailsPage1 , and detailsPage1 push DetailsPage2
So Video on DetailsPage1 always running When we are on detailsPage2

I changed
MasterPage1 => DetailsPage (with Data1, and next i change to Data2, no more push, and less state, better perf)

But it’s very specific I think, I do not know if it will help you.


#4

I doing this and I cannot force refresh. How are pushing navigation?

I do:
this.nav.push(Channel, {
canal: canal,
tab: this.tabId
});

I think it was the correct way to navigate to Channel. But how can I navigate from Channel to Channel refreshing all HTML view?


#5

i dot not navigate to a new page, i only change the data of the current page (no more push between DetailsPage1 and DetailsPage2)

That may not be a solution for you.

Or wait to see if the problem will correct


#6

One way I can think of is to implement ngOnDestroy in the “previous” page component and do some housekeeping there.

Also ionic 2 provides hooks that can be useful too, I haven’t tried myself though

···
ionViewWillLeave
ionViewDidLeave
ionViewWillUnload
ionViewDidUnload
···


Page navigation partially fails with page still on stack
#7

agree! I tried this solution.

don’t forget the nav.pop (get the page from cache)

as page are in navigation state, ionViewWillUnload and ionViewDidUnload will not fire

You can load data in ionViewWillEnter and unload in ionViewDidLeave. But in this case the cache no longer works.