title: Reset a $rootScope property on location change in Angular.js
body: <p>in my application I have a <em>$rootScope</em> property called <em>$rootScope.currentStatus</em> used to set a css class on body under some circumstances.</p>
  
  <p>The problem is that I need to reset the value to a default any time the user leaves the current page, but I don't know where I can intercept the location change. Currently I use a $routeProvider:</p>
  
  <pre><code>app.config(function ($routeProvider, $locationProvider, $httpProvider) {   
      $routeProvider.when('/site/dashboard', {
          templateUrl: '/partials/site/dashboard.html',
          controller: 'DashboardCntl',
          resolve: {
              loggedin: checkLoggedin
          }
      });
  
      ....
  });
  </code></pre>
  
  <p>with many entries. I could use <strong>resolve</strong> adding a function that reset my variable but I'd have to insert in on all my routing entries.</p>
  
  <p>Do you have any other idea?</p>