[SOLVED] Disable back in Ionic2

Anyone knows how to remove a view from the back history?

In Ionic 1 I solved this with

this.$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true
});

Would be really useful, for example, to fully remove the Login page of my application from the history once a successfully login was performed.

I am using something like this:

this.nav.push(TabsPage).then(() => {
  const index = this.nav.getActive().index;
  this.nav.remove(0, index);
});
4 Likes

Awesome, work like a charm. Thx

you can try this one too…

this.nav
  .push(DetailsPage)
  .then(() => {
    const index = this.viewCtrl.index;
    this.nav.remove(index);
  });

https://alexdisler.com/2016/04/15/remove-page-modal-from-navigation-stack-ionic-2/28

2 Likes

Is this.nav.setRoot(…) what you need?