I am trying to retrieve my search and filter data from sessionStorage when the page refreshes.
sessionStorage.restorestate returns undefined, does anyone know why?
app.run(function($rootScope) {
$rootScope.$on("$routeChangeStart", function(event, next, current) {
if (sessionStorage.restorestate == "true") {
$rootScope.$broadcast('restorestate'); //let everything know we need to restore state
sessionStorage.restorestate = false;
}
});
//let everthing know that we need to save state now.
window.onbeforeunload = function(event) {
$rootScope.$broadcast('savestate');
};
});
sessionStorage
setting code gets called in your plnkr – BioastronauticsngRoute
so there cannot be any route changes. Plus I can't see any line of code that setssessionStorage.restorestate
to anything so its never going to be"true"
. Is there some piece of code missing? – Ingot