title: How do I handle page refreshing with an AngularJS Single Page Application
body: <p>Two problems have troubled me as I have learned angular:</p>
  
  <ol>
  <li><p><em>How do I restore state when the user refreshes the page or hits the back button?</em></p></li>
  <li><p><em>How do I share data between scopes belonging to different controllers?</em></p></li>
  </ol>
  
  <p>Below I show a simple solution that makes use of client-side session storage. It allows for both the sharing of common data and the automatic restoration of state after a user refreshes the page or hits the back button.</p>
  
  <p>Note: The solution below proved essential to answer the following question:</p>
  
  <p><a href="https://stackoverflow.com/q/22247294/776476">How do I get the Back Button to work with an AngularJS ui-router state machine?</a></p>