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?
-
You can't. It's the end user's browser, not yours. And if the end user wants to go back, he can.JB Nizet– JB Nizet2014-06-15 17:26:43 +00:00Commented 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 loadMilad– Milad2014-06-15 17:47:40 +00:00Commented 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 scriptArchimedes Trajano– Archimedes Trajano2014-08-28 18:49:42 +00:00Commented Aug 28, 2014 at 18:49
Add a comment
|
1 Answer
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;
}