Any update on this feature request? The ability to manipulate the back stack – specifically, preventing a particular page from entering the history – is quite important. The JavaScript location.replace() and ui-router $state.go(..., ..., {location: "replace"}) analogs have existed for ages.
almost got this to work, but would be really cool if someone who really knows the history stuff could get it to really work… I added this to $ionicHistory:
In case this helps anyone, I have a snippet that manipulates the history. My case is where there from the 2nd screen in the app, there is 3 more screens to select something, and if you complete the action on the last screen then I want to pop those 3 screens off the stack.
var viewHistory = $ionicHistory.viewHistory()
// pop off the photo selection screens and set the back view to the profile edit page
var history = viewHistory.histories[viewHistory.currentView.historyId]
history.stack.splice(2, 3)
history.cursor = 1
viewHistory.backView = history.stack[1]
$ionicHistory.goBack()