Have the same problem. I hope it will help you How do I get the Back Button to work with an AngularJS ui-router state machine?
It's a little bit hard for me and it seems there must be a simpler solution
Edit:
I did it.
First of all you need your old state (also we have wrapper for localstorage, so you should change methods).
angular
.module('app')
.run(appRunFunction);
appRunFunction.$inject = ['$rootScope', 'localstorage'];
function appRunFunction($rootScope, localstorage) {
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParam, fromState, fromParam) {
localstorage.setValue('lastState', fromState.name);
});
};
We also have written a service that redirects from an abstract state to regular state after comparison your next regular state with your last one
angular
.module('app.services')
.factory('states', states);
states.$inject = ['$state', 'localstorage'];
function states($state, localstorage) {
var service = {reloadWithParam: reloadWithParam};
return service;
function reloadWithParam(param, value) {
var fromState = localstorage.getValue('lastState') + '.' + localstorage.getValue('lastPage');
var toState = $state.current.name + '.' + value;
var paramObject = {};
paramObject[param] = value;
if (fromState === toState) {
window.history.go(-1);
} else {
$state.go($state.current, paramObject, { notify: false});
localstorage.setValue('lastPage', value);
}
}
}