title: Angular: Restore scope from sessionStorage
body: <p>I am trying to retrieve my search and filter data from sessionStorage when the page refreshes.</p>
  
  <p>sessionStorage.restorestate returns undefined, does anyone know why?</p>
  
  <pre><code>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');
      };
    });
  </code></pre>
  
  <p>Plunkr: <a href="http://plnkr.co/edit/oX4zygwB0bDpIcmGFgYr?p=preview" rel="noreferrer">http://plnkr.co/edit/oX4zygwB0bDpIcmGFgYr?p=preview</a></p>