title: Angular route not entering the resolve function
body: <p>I'm adding route authentication to my angular app.</p>
  
  <p>For some reason when I try to navigate to the <code>logentries</code> view, I cannot get the code in the <code>resolve</code> function to execute.  </p>
  
  <p>I've added a breakpoint using <strong>Chrome developer tools</strong>, but it doesn't get hit.</p>
  
  <p>The view does get loaded, however.</p>
  
  <p>I thought the resolve would get hit before the controller is instantiated and the view rendered.  </p>
  
  <p>Why isn't it?</p>
  
  <pre><code>(function () {
      'use strict';
  
      angular.module('app')
          .config(appConfig)
          .run(routeAuthentication);
  
      routeAuthentication.$inject = ['$rootScope', '$location'];
  
      function routeAuthentication($rootScope, $location) {
          $rootScope.$on('$routeChangeError', function (event, current, previous, rejection) {
              if (rejection === 'Not Authenticated') {
                  console.log('Not Authenticated for Route');
                  $location.path('/');
              }
          });
      }
  
      appConfig.$inject = ['$routeProvider'];
  
      function appConfig($routeProvider) {
          $routeProvider
              .when("/logentries", {
              templateUrl: "app/views/logEntries.html",
              controller: "logEntries",
              resolve: function ($q, $location) {
                  // Code not entering here as far as I can tell.
                  var deferred = $q.defer(); 
                  deferred.resolve();
                  if (true) { // TODO - use authenticationServce
                      $location.path('/login');
                  }
  
                  return deferred.promise;
              }
          })
          // other routes
      };
  })();
  </code></pre>