Ionic 2 Go to Root without Invoking constructor or lifecycle events

I am using the RC0 of Ionic 2 with the tabs template.

I have a button on tab2, clicking it should clear history and navigate to tab1. I have tried various different ways to navigate to root. But every time i do that the constructor of tab1 is called again.

Here is the button click function in tab2

    goingBack(){
      this.navCtrl.setRoot(tab1);
  //    this.navCtrl.setPages(tab1);
    //  this.app.getRootNav().setRoot(tab1)
     }

Doing so calles the constructor of tab1 and the ionViewDidLoad lifecycle event as well, which i do not want.

Any help is appreciated.

1 Like

This sounds to me like something you should not be relying on or worrying about, because the framework should be free to change how it behaves. Can you describe what you are really fundamentally trying to achieve, so people can perhaps help you realize it in a more robust way?

well I have some http calls that i want to make when the view loads. I tried in the constructor and ionViewDidLoad which are supposed to be called only once.

But calling setRoot() and navigating to that view again makes the http call again which I do not want.

In short what I want is to navigate to a view in history and clear the navigation history without calling the constructor functions so I do not make duplicate http calls