Last active
July 14, 2016 09:07
-
-
Save cengkuru/b7c726df73549eef0393addea2fc3226 to your computer and use it in GitHub Desktop.
track current and previous state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rootScope.previousState; | |
$rootScope.currentState; | |
$rootScope.$on('$stateChangeSuccess', function(ev, to, toParams, from, fromParams) { | |
$rootScope.previousState = from.name; | |
$rootScope.currentState = to.name; | |
console.log('Previous state:'+$rootScope.previousState) | |
console.log('Current state:'+$rootScope.currentState) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment