Actually it is using angular-ui.
http://stackoverflow.com/questions/16635381/angularjs-ui-route-get-previous-state
Explanation:
ui-router doesn't track the previous state once it transitions, but the event $stateChangeSuccess is broadcast on the $rootScope when the state changes.
You should be able to catch the prior state from that event ("from" is the state you're leaving):
$rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {
//assign the "from" parameter to something
});
Example:
Add this code to your app's abstract template so it runs on every page.
$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)
});
Keeps track of the changes in rootScope. Its pretty handy.