I know that there is $stateChangeStart
function in angular that can perform action as follow.
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) { });
However, i am developing an ionic v1 app, in which i would like to use a more intuitive way, which is the ionic life cycle. I am wondering if it is possible to get toState
and toParams
in $ionicView.beforeLeave
as i am unable to find any documentation on this. eg:
$rootScope.$on('$ionicView.beforeLeave', function (event, toState, toParams) { });
1 Answers
Answers 1
The ionic $ionicView.beforeLeave event can take function with 2 arguments. From the argument you can get only from state, it will not give you to state.
$rootScope.$on("$ionicView.beforeLeave", function(event, data){ // handle event console.log("Event: ", event); console.log("Data: ", data); })
0 comments:
Post a Comment