[SOLVED] Disable back in Ionic2


#1

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.


#2

I am using something like this:

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

#3

Awesome, work like a charm. Thx


#4

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


#5

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