I have a side menu with many pages attached to it.
states are simply like this:
.state('menu.home', {
url: "/home",
views: {
'menuContent' :{
templateUrl: "home.html"
}
}
})
.state('menu.login', {
url: "/login",
views: {
'menuContent' :{
templateUrl: "login.html"
}
}
})
I have a back button on the menu page.
<ion-nav-bar class="bar-positive"animation="no-animation">
<ion-nav-back-button class="button-icon ion-arrow-left-c">
</ion-nav-back-button>
</ion-nav-bar>
Scenario 1: on successful login, $state.go(‘menu.home’, null, {location: ‘replace’});
Problem 1: the ion-nav-back-button still appears, the ‘location replace’ only prevents the actual browser’s back button from going back to the login page.
Scenario 2: if ionic navigation has keep a history like [menu.A, menu.B, menu.C]. Then I go to a form page to submit a request, on success redirect back to menu.C. So history might now be like [menu.A, menu.B, menu.C, menu.search, menu.form]
here, i call $state.go(“menu.C”, {}, { location: “replace” });
clicking on the ion-nav-back-button will bring me back to menu.form
Problem 2: how do i remove [menu.search, menu.form] from the history? or is this a common behavior and not really a problem if the user goes back to the form page?
calling this seems to clear the entire history
$ionicViewService.nextViewOptions({
disableBack: true
});