How to know which view back from in the previous view?

As the title says.

In view B’s controller I use $ionicHistory.goBack() back to view A . In view A how to know which view back from?

From the ionic docs http://ionicframework.com/docs/api/service/$ionicHistory/

$ionicHistory.backView()
Returns the view that was before the current view in the history stack. If the user navigated from View A to View B, then View A would be the back view, and View B would be the current view.

you can also use the viewHistroy() method to see more details on the full history stack

Thanks for your help.

1 Like