title: How can I redirect from an AngularJS controller to an Express route?
body: <p>I'm using the boilerplate stack from MEAN.io and finding it quite a good starting point, however I'm having trouble mixing the different routing commands. My app is going to have a simple signin page which is public, everything else is hidden behind that. I can check if the user is authenticated no problem, but I cannot for the life of me get Angular to load the signin page from the server. I already have a signin button on my html page that calls the correct route no problem at all, I just can't do the same thing from code.</p>
  
  <p>The $location.path('/signin'); code doesn't call the server because it leaves the hash in the path </p>
  
  <p>My Angular controller</p>
  
  <pre><code>angular.module('tms.tweets').controller('TweetsController', ['$scope', '$routeParams',
  '$location', '$resource', 'Global', 'Tweets', function ($scope, $routeParams, $location,
  $resource, Global, Tweets) {
  $scope.global = Global;
  
  $scope.find = function() {
  
      if(Global.authenticated){
  
          console.log(Global.authenticated);
  
          Tweets.query(function(tweets) {
              console.log("Tweets at Angular Controller: " + tweets.length);
  
              $scope.tweets = tweets;
          });
      }
      else{
          console.log("Unauthorized");
  
          $location.path('/signin');
      }
  
  };
  }]);
  </code></pre>