Navigating to/from views without destroying them (caching views?)


#1

Hello,

I am trying to navigate between views without having the views destroyed after navigating away from them. The pop() method on the NavController does not cache the views (and I can’t seem to find the property to cache anywhere in the docs - if it exists), hence when I navigate back to them, the component constructor and of course the ionViewDidLoad method, fires again. This is not what I need for these views. I have tried to meddle with setRoot and pushing new views, yet this just turns into a jumbled mess. I simply want view A, B, C created once and be able to navigate between them.

A note, I do want to include the animations, since I am using swipe events to allow the user to navigate in this particular set of views. I am aware that what I ask is possible with tabs though that my views are nested in tabs. So perhaps the answer is nested tabs … ? Then the question becomes, how to animate the transitions initiated by swipes? Also, if this nut has been cracked, examples would be appreciated!

Besides this, is there a way to explicitly cache views and their state while navigating between them? Perhaps an option in the pop() method to not destroy the view so it does not have to be re-loaded?

Thanks,

Rob