Nav getPrevious() works on livereload, fails without it

In my app, a user can go to the profile page from different pages (homepage, settings, etc). When he goes to the profile page to update his profile and saves it, I want to return to the origin page it came from (home page, whatever). I don’t want to use navctrl.pop() because I need to reload the origin page. I used the following…


It works fine when debugging on the device with livereload, but when I debug without livereload, or when I install the apk on the device, it doesn’t work (doesn’t advance to the origin page).

Any suggestions? Or a better way of going to the origin page after saving?


Can u try this.navCtrl.setRoot(Your Controller Name or Component Name )

Thanks, @Lakshmareddy. If I hardcode the controller/component name like so…


, it works fine. But using this.navCtrl.getPrevious().name doesn’t give the name when debugging without livereload - with livereload, this.navCtrl.getPrevious().name = ‘TabsHome’ as expected.