title: how to detect location change
body: <p>I have a controller that shows a page navigation menu. The menu has an array of items, and each item has a caption and a link. I also set a flag on each item that indicates whether the related page is currently shown:</p>
  
  <pre><code>module.controller('MenuContr', [
      /******/ '$scope', '$location',
      function ($scope,   $location) {
          $scope.items = [
              {text: 'page 0',
               href: '#/page-0',
               current: $location.path() === '/page-0'},
              {text: 'page 1',
               href: '#/page-1',
               current: $location.path() === '/page-1'}
          ];
  </code></pre>
  
  <p>in my template:</p>
  
  <pre><code>&lt;ul class="menu" ng-controller="MenuContr" ng-cloak&gt;
    &lt;li ng-repeat="item in items" ng-switch on="item.current"&gt;
      &lt;span class="current" ng-switch-when="true"&gt;{{item.text}}&lt;/span&gt;
      &lt;a ng-switch-default ng-href="{{item.href}}"&gt;{{item.text}}&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I need to be able to update the menu when the location changes, how is it done? Is there an event that I can subscribe to?</p>
  
  <p>EDIT: this controller is used in addition to the controllers that are defined in my routes, and the above template is placed above the element containing <code>ng-view</code> directive.</p>