How to emulate "setRoot" functionality with Angular router in Ionic 4?


#1

Hey team, anyone know how to emulate the old navCtrl.setRoot() functionality with the Angular router?

It looks like by default, is stacking my pages and I need it to not do that when transitioning between certain screens (login to app for example – you don’t want a back button to go back to the login screen after a successful login).

appears to have a property called “stack” that I can set to false but that doesn’t appear to do anything?

Thanks in advance.


#2

There are methods available for interacting with the router in NavController, you can use:

this.navCtrl.goRoot('/route');

#3

Awesome. Thanks Josh, that works perfectly.