Ui-sref disable back button

Is there a way to disable the back button on the destination page after clicking a button with ui-sref heading to the destination page?

Have you tried to clear the history when entering destination page?

No… How do I do that?

Either you do it in your destination controller but you got to make sure your controller is reloaded each time you go to this view (try to put cache: false in your state) or you do it in the resolve property of your state.

For the history part, search the forum.

use ng-click on the button instead of ui-sref
in the click function use $ionicHistory.nextViewOptions()-function to hide back-button on the next view.
http://ionicframework.com/docs/api/service/$ionicHistory/

After that redirect with $state.go().

1 Like