title: Angular $location not updating when browser back is used
body: <p>Has anyone run across this behaviour? There isn't much mentioned about it, and the other posts are different in nature. This appears to be inconsistent w/ documentation about browser behaviour.</p>
  
  <blockquote>
    <p>Synchronizes the URL with the browser when the user </p>
    
    <ul>
    <li>Changes the address bar. </li>
    <li><strong>Clicks the back or forward button</strong> (or clicks a History link). </li>
    <li>Clicks on a link.</li>
    </ul>
    
    <p><a href="https://docs.angularjs.org/api/ng/service/" rel="nofollow">https://docs.angularjs.org/api/ng/service/</a>$location#!</p>
  </blockquote>
  
  <p>What happens:</p>
  
  <ul>
  <li><a href="http://pp.gocactus.com" rel="nofollow">Load page</a> - hash updates (<a href="http://localhost:9000/#/" rel="nofollow">http://localhost:9000/#/</a>)</li>
  <li>Click 'Start' - update $location.$$path via function to update hash and load new view (<a href="http://localhost:9000/#/guide" rel="nofollow">http://localhost:9000/#/guide</a>)</li>
  <li><strong>Tricky! User clicks back-button in browser, hash updates back to <a href="http://localhost:9000/#/" rel="nofollow">http://localhost:9000/#/</a> but debug tells me $location.$$path still thinks we are at $location.$$path = /guide</strong> - logic based on location path doesn't work.</li>
  </ul>
  
  <p>This is a watcher to on location to help debug:</p>
  
  <pre><code>// listen for the event in the relevant $scope
  $rootScope.$on('locationChange', function (event, data) {
      console.log(data);
  });
  
  //Call locationChange watch at anytime the page is loaded 
  $scope.$emit('locationChange', $location.$$path);
  </code></pre>
  
  <p>Here's the routing:</p>
  
  <pre><code>$routeProvider
      .when('/guide', {
          templateUrl: 'views/guide.html',
          controller: 'GuideController',
          controllerAs: 'guide'
      })
      .when('/', {
          templateUrl: 'views/about.html',
          controller: 'AboutCtrl',
          controllerAs: 'about'
      })
      .otherwise({
          redirectTo: '/'
      });
  </code></pre>