rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) { $rootScope.previousState = from; $rootScope.previousParams = fromParams; });