bug: $ionicHistory.clearHistory() not working on Android
Type: bug
Platform: android 4.4 webview
$ionicHistory.clearHistory() doesn't seems to remove the view from the stack history on Android as I have been able to go back to previous views using hardware back button.
+1
Version : 1b14 Android : 4.4
I try the following code but the hardware back button goes back to the view A :
View A
$ionicHistory.nextViewOptions({ disableBack: true, historyRoot: true }); $state.go(path);
View B
$ionicHistory.clearHistory();
EDIT 26/01 :
Ok, I was wrong : $ionicHistory.clearHistory() works for me :)
FYI, the problem happens whether one of my $ionicPlatform.ready functions throws an exception.
Is the controller in which you're executing clearHistory() cached? If so, it may not be executing.
You may want to try adding cache: false to your state depiction for that view/controller.
Greetings @msalman!
I'm sorry, but my sensors indicate that this issue may no longer apply to recent versions of Ionic.
If you are still experiencing this issue, please feel free to reopen it by creating a new issue and provide the following information, so that I may assist you:
- Can you provide a detailed description of this issue?
- How would a robot go about replicating this issue?
- On which platform does this occur? (iOS, Android, all, etc.)
- On which platform versions does this occur? (Android 4.2, iOS 7, all, etc.)
- Is this an issue with the Ionic Framework or Ionic CLI?
Additionally, providing a codepen that replicates the issue is extremely helpful.
If you wish to get help using the framework itself, I recommended visiting the forum. There are many humans there who can offer sage advice.
Thank you for allowing me to assist you.
Hi techtrails, thanks for the input, below is my use case
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.