1

My app has one view, and a home page, when user opens the home page, I don't want the 'back' button appear. How can I do it?

3
  • You can't. It's the end user's browser, not yours. And if the end user wants to go back, he can. Commented Jun 15, 2014 at 17:26
  • If your are testing , and this is an error with your browser too , and if you are opening your browser first time with your app and all of a sudden there is a back button , maybe you are using a $location.path() incorrectly on page load Commented Jun 15, 2014 at 17:47
  • Perhaps what you are looking for is a way of disabling the back button functionality when you are using Routing? What I did in my case was to avoid router and do the changes to the page and state within my script Commented Aug 28, 2014 at 18:49

1 Answer 1

1

there is no way to disable. one thing you can do which may accomplish the goal of not allowing the user to go backward is detect the transition backwards that you'd like to avoid and hack in a $state.go back to the fromState. this would have the effect of the back-button not doing anything. something like:

 $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {

    if (goingBackwardsAndShouldntBe(toState, fromState)) {
      $state.go(fromState.name);
      return;
    }   
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.