title: Routing not working in Angular.js
body: <p>I have an angular.js controller (<code>loginErrorCtrl</code>) that is supposed to redirect to a view (<code>/menu</code>) when the data supplied from an input is equal to a specified string defined in the app (<code>Data.serverToken</code>).</p>
  
  <pre><code>function loginErrorCtrl($scope, Data, $location) {
    $scope.data = Data;
    $scope.validateToken = function(token) {  
      if (token != null) {
        if (token.length == 4) {
          if (token == Data.serverToken) {
            $location.path('/menu');
            } else {
            //error
            return "Invalid Token please try again";
          }
        }
      }
    };
  }
  </code></pre>
  
  <p>The problem is that, when I type the correct token into the input box the  <code>$location.path('/menu')</code> doesn't redirect until I hit the backspace. How can I get it to redirect upon successful validation of token?</p>
  
  <p>Code listing on plunker : <a href="http://plnkr.co/edit/f1viaDXqa59U2ZQakUEr" rel="nofollow">Angular JS routing</a> </p>