i have an simple ion sidebar app with links inside the sidebar so when the user taps on the link in the sidebar a new view is loaded
but when the user taps the back button i want them to go to the home page form the view in which they where.
i accomplish this using > $state.go(‘state.name’)
And it works fine but when i arrive at the home pace the sidebar “hamburger” icon is replaced with a back button to the view.
so is there a way to navigate to home without any history?
i am using all latest version of ionic
Use $ionicHistory to set the next view as the root:
$ionicHistory.nextViewOptions({
historyRoot: true
});
$state.go('app.home');
3 Likes
yes thanks will try that out but did it with this code for now
$ionicViewService.nextViewOptions({
disableBack: true
});
$state.go('app.home');
Okay. I use the above code because I use a sidemenu. If you use a sidemenu the menu icon won’t show up because it will still think there is a backview.
1 Like
@brandyshea…
I tried this it works just fine showing menu bar icon as well
$ionicHistory.nextViewOptions({
historyRoot: true
});
$state.go('app.home');