Ionic put one view from the stack top

I’m on ViewAPage. Then I push ViewBPage in the navigation stack, then ViewCPage.

Now I want to push ViewAPage on the front of the navigation stack. How can I achieve that?

These 3 views are quite expensive to render, so I’d like to keep them and not remove them if the user navigates between them. :slight_smile:

hey @HugoHeneault,

you have several ways to achieve this, it depends on you. Follow this link: https://ionicframework.com/docs/api/navigation/NavController/

take a look to these method there:
getByIndex(index)
or
getPrevious(view)

Hey @quieterkali! Thanks for your fast reply :slight_smile:
But if I put a new View it will be created again? I’d like to put an existing one on top.

it’s a stack so you can pop to the existing one or push a new one. since you want the to move back to the old one so you according to your navigation story you can find out how far is the page you want to go back and use one of those two method to reach the page.
for example:
"I’m on ViewAPage. Then I push ViewBPage in the navigation stack, then ViewCPage."
since you know the page you want is before “ViewBPage”, you just have to do this: getPrevious(ViewBPage) then he will move you back to ViewAPage.

you’re welcome, i feel really good helping people, and i learn from that too :slight_smile:

Yeah, but I’d like to keep my stack.

These 3 views are quite heavy to render, so if the user is navigating between them, I’d like them to become visible without having to re-render them.

So popping back to the view I want is not the best solution, as ViewB and ViewC will be removed with the pop()

But as far i know navigate throught a stack is this way, you cant just take a page from the bottom and move it to the top. Are they heavy to render cause of data they fetch from your api?