title: Angular not reading $rootScope variable during $locationChange
body: <p>I've set a login variable using <code>$rootScope</code> so my code knows if a user is logged in or not:</p>
  
  <pre><code>$rootScope.login = true;
  </code></pre>
  
  <p>Now, I want to redirect any location changes to the login page if the user is not logged in. So I tried this:</p>
  
  <pre><code>$scope.$on('$locationChangeStart', function(){   
    if (!$rootScope.login) $location.path('/');
  });
  </code></pre>
  
  <p>But in this case, <code>$rootScope.login</code> returns undefined. If I try to print the variable to the page like so <code>{{login}}</code> it indeed shows true, so I know the variable is being set. What have I done wrong in my location change?</p>