ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

disableBack in $ionicHistory.nextViewOptions fails sometimes.

Open hussainb opened this issue 11 years ago • 5 comments

Hello,

I created the below view by using the 'stripe styled tabs'. I wanted to mimic the sub tab functionality of other android apps. but couldnt find any docs on it in ionic so I created a three different routes for the tabs and just change the 'active' class for the selected tab.

What I noticed is that since I am just simulating sub-tabs the history should not change and the back button shouldn't be visible.

So, I added the following in all the tab routes controllers

$ionicHistory.nextViewOptions({
    disableBack: true,
    disableAnimate: true
});

While interchanging/navigating between the tabs, the above code works for 4-5 times, but then, the normal history enabled behavior starts to take place, the view starts animating and the back button starts appearing.

image

hussainb avatar Mar 29 '15 18:03 hussainb

Hi, I have a simple login based application in which user can access About menu with or without login, issue came with android hardware back button,

Login screen > About page > From Menu go to Login > Press hardware back button > Application Should get closed rather go to About page.

Below is the code for navigation to login screen.

$scope.login = function() {
            $ionicHistory.nextViewOptions({
                disableBack: true,
                disableAnimate: true,
                historyRoot: true
            });
            $ionicHistory.clearCache();
            $ionicHistory.clearHistory();
            $ionicSideMenuDelegate.toggleLeft();
            $state.go('login');
        };

I am using ionic rc release 4 currently.

msalman avatar Apr 30 '15 09:04 msalman

Could you put these in a codepen or something we can inspect?

perrygovier avatar May 20 '15 22:05 perrygovier

Greetings @hussainb!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Jun 20 '15 08:06 Ionitron

Greetings @hussainb!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Jun 20 '15 08:06 Ionitron

I recently encountered this issue, the way I solved it was changing historyRoot to false:

$ionicHistory.nextViewOptions({ disableBack: true, disableAnimate: true, historyRoot: true })

to

$ionicHistory.nextViewOptions({ disableBack: true, disableAnimate: true, historyRoot: false })

liamzebedee avatar Jan 09 '16 06:01 liamzebedee