title: How do I get the angularJS routeProvider to perform an action before the route change?
body: <p>Let's say I have this config:</p>
  
  <pre><code>app.config(['$routeProvider',
    function($routeProvider) {
      $routeProvider
          .when('/', { 
              templateUrl: 'app/partials/index.html',
              controller: 'defaultCtrl'
          })
          .when('/other', {
              templateUrl: 'app/partials/other.html',
              controller: 'errorCtrl'
          })
          .otherwise({ 
              templateUrl: 'app/partials/404.html'
          });
    }
  ]);
  </code></pre>
  
  <p>I'm looking for a place to do some basic, common maintenance code before the router calls the route. Say I'd like to clear the console log via <code>console.clear()</code> every time the route is changed. How and where would be the best place in the code to do that?</p>