Beta 13 prevent back behaviour

I am wanting to prevent the back button from working on a specific page, but I want it to show. Because I want to use my own logic on this page (loading a certain view).

Does anybody know how this could be done? I have already attempted using event.preventPropagation and event.preventDefault, and event.stopImmediatePropagation(); with no luck.


Just an idea, but you could override the back function. If it’s always a specific page that you want to disable the back button for you can get it by state name, or you could add a property to the state itself and check for that. See this codepen where I disabled the back on page 2 but not on page 3:

1 Like

Wow that is so strange, just adding

$rootScope.goBack = function() {

and adding it to the backbutton click gave me exactly the logic i needed :3

Thank you for your help…

1 Like