Prevent back button from going back to a page

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">

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.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.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

          disableBack: true

is this not a common problem? can someone please help?

I am looking for a similar solution to this a scenario like this, have you had any luck?

I had this same situation. I had a form that after submitting successfully I redirect to another view and I don’t want the back button to show up and allow the user to go back to the form again. I found the answer on a github thread

$state.go('bla', ..., {location: 'replace'});

You can find the full thread here

UI-router replace location doesn’t work well with the way ionic built their history. We have a large app that needs this functionality so I’m trying to push this fix