title: AngularJS - Need some combination of $routeChangeStart and $locationChangeStart
body: <p>My problem is actually very similar to the one found here:</p>
  
  <p><a href="https://stackoverflow.com/questions/16344223/angularjs-cancel-route-change-event">AngularJs - cancel route change event</a></p>
  
  <p>In short, I'm using $routeChangeStart and trying to change the current route using $location. When I do, the console shows me that the original page is still loads and is quickly overwritten by the new page.</p>
  
  <p>The solution provided was to use $locationChangeStart instead of $routeChangeStart, which should work for preventing the extra redirect. Unfortunately, I'm using additional data in the $routeprovider that I need to access while changing the route (I use it to track page restrictions). Here's an example...</p>
  
  <pre><code>$routeProvider.
      when('/login', { controller: 'LoginCtrl', templateUrl: '/app/partial/login.html', access: false}).
      when('/home', { controller: 'HomeCtrl', templateUrl: '/app/partial/home.html', access: true}).
      otherwise({ redirectTo: '/login' });
  
  
  $rootScope.$on('$routeChangeStart', function(event, next, current) {
      if(next.access){
          //Do Stuff
      }
      else{
          $location.path("/login");
          //This will load the current route first (ie: '/home'), and then
          //redirect the user to the correct 'login' route.
      }
  });
  </code></pre>
  
  <p>With $routeChangeStart, I can use the "next" and "current" parameters (see <a href="http://docs.angularjs.org/api/ng.$route" rel="nofollow noreferrer">AngularJS - $route</a>) as objects to retrieve my 'access' values. With $locationChangeStart, those two parameters return url strings, not objects. So there seems to be no way to retrieve my 'access' values.</p>
  
  <p>Is there any way I can combine the redirect-stopping power of $locationChangeStart with the object-flexibility of $routeChangeStart to achieve what I need?</p>