How to proper use popTo?

We have a few pages in the stack and we want to navigate to a certain page in the beginning of the stack and to do so, we use the following code:

let exerciseItemViewController: ViewController = this.nav.getPrevious(this.nav.getActive());
let exerciseItemNavConroller: NavController = exerciseItemViewController.getNav();
let exerciseViewController: ViewController = exerciseItemNavConroller.getPrevious(exerciseItemViewController);
let exerciseNavConroller: NavController = exerciseViewController.getNav();
let modulesViewController: ViewController = exerciseNavConroller.getPrevious(exerciseViewController);


This is horrible. Is there an easier and more elegant way of doing this?

1 Like

If you notice, in the docs, popTo is not documented.
Meaning its not meant to be used, outside of the internal framework.

1 Like

Thanks @mhartington Ok, I read the documentation. But is there a way for example to navigate 2 or 3 steps back?

Means, I’m at page E and I want to navigation to page B

  • Page A
  • Page B
  • Page C
  • Page D
  • Page E

Per documentation this is not possible. Right?

Hi @mhartington. Any feedback regarding this? Sorry, just wondering, navigation is very important overall and we don’t know how to handle such transitions

In RC3, popTo work without problem but there is some major flaw when calling it with parameters.
In NavController definition file there is popTo function deifnition as

abstract popTo(page: any, params?: any, opts?: NavOptions, done?: Function): Promise<any>;

but in NavControllerBase source file, popTo function is defined as:

NavControllerBase.prototype.popTo = function (indexOrViewCtrl, opts, done) {...}

Can you fix that so we can call popTo methode with parameters? Thanks…

1 Like

I also have issues with popTo(), I use it to go back 2 steps, i.e. I go from A -> B -> C, then from C popTo A, it works but the tabs bar at the bottom disappeared.