Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
-5
rated 0 times [  1] [ 6]  / answers: 1 / hits: 17066  / 10 Years ago, sat, march 15, 2014, 12:00:00

In Ionic I can go back just using:



var backView = $ionicViewService.getBackView();
backView && backView.go();


The question is how to go to the view before backView? Something like:



var backBackView = $ionicViewService.getView(-2);
backBackView && backBackView.go();

More From » angularjs

 Answers
6

After some experiments I ended with next solution:



var backView = $scope.$viewHistory.views[$scope.$viewHistory.backView.backViewId];
$scope.$viewHistory.forcedNav = {
viewId: backView.viewId,
navAction: 'moveBack',
navDirection: 'back'
};
backView && backView.go();


It looks bad for me, but successfully resolves the problem. I hope this will help to someone.



Update: Now you could actually call



$ionicHistory.goBack(-2);


which is described in ionic's documentation.


[#71972] Friday, March 14, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
briza

Total Points: 259
Total Questions: 94
Total Answers: 101

Location: Reunion
Member since Mon, Dec 28, 2020
4 Years ago
;