Navigating from an Overlay Component inside a child Nav


#1

Hi! I need help with a complex navigation in my app.

I have a 2 level ion-nav structure (an ion-nav inside and ion-nav) and from the children I open a modal. When clossing I want to setRoot() to certain page inside the children nav. Ex.

nav-parent
nav-children
Page 1
Page 2 (root) - A - B - C - Modal

I want to go from Modal -> Page 1 and set that as root

Reading the documentation I saw the “Navigating from an Overlay Component” here where it makes something like: `constructor(
public viewCtrl: ViewController
public appCtrl: App
) {}

pushPage() {
  this.viewCtrl.dismiss();
  this.appCtrl.getRootNav().push(SecondPage);
}`

However getRootNav() will take the parent ion-nav and wont do the transition correctly, I managed to fix my problem by doing:

this.viewCtrl.dismiss();
this.appCtrl.getRootNav()._children[0].setRoot('MyPage');

But I feel that is such a dirty solution and kinda hardcoded, can I get a suggestion for this scenario?
Thanks!