How to redirect to home page and remove the back button on navigation bar


#1

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


#2

Use $ionicHistory to set the next view as the root:

$ionicHistory.nextViewOptions({
    historyRoot: true
});
$state.go('app.home');

Replacing back button with menu icon
#3

yes thanks will try that out but did it with this code for now

$ionicViewService.nextViewOptions({
   disableBack: true
});
$state.go('app.home');

#4

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.


#5

@brandyshea

I tried this it works just fine showing menu bar icon as well

$ionicHistory.nextViewOptions({
    historyRoot: true
});
$state.go('app.home');