title: Node+express+Angular- calling route results in infinite loop call of controller
body: <p>I am using node js with express. Angular js files are loaded through index.html</p>
  
  <p>app.js code</p>
  
  <pre><code>app.use(bodyParser.json()); // for parsing application/json
  app.use(bodyParser.urlencoded({ extended: true })); 
  app.engine('html', engines.nunjucks);
  app.set('view engine', 'html');
  app.set('views', __dirname + '\\views');
  
  app.use('/js', express.static(__dirname + '/js'));
  app.use('/css', express.static(__dirname + '/css'));
  
  
  app.all('/*', function(req, res, next) {
     // Just send the index.html for other files to support HTML5Mode
     res.sendFile('index.html', { root: __dirname });
   });
  
  app.listen(3006, function() {
    console.log("listening");
   }); //the port you want to use
  </code></pre>
  
  <p>index.html code</p>
  
  <pre><code>&lt;head&gt;
      &lt;base href="/" /&gt;
       &lt;!-- META --&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;      
  &lt;/head&gt;
  &lt;body ng-app="movies-app"&gt;
       &lt;div ng-view&gt;&lt;!--view will be injected here --&gt;&lt;/div&gt;
  
      &lt;script src="/js/lib/angular.js"&gt;&lt;/script&gt;&lt;!-- load angular --&gt;
      &lt;script src="/js/lib/angular-sanitize.js"&gt;&lt;/script&gt;&lt;!-- load angular sanitize --&gt;
      &lt;script src="/js/lib/angular-route.js"&gt;&lt;/script&gt;&lt;!-- load angular route --&gt;
      &lt;script src="/js/movieApp.js"&gt;&lt;/script&gt;&lt;!-- load controller --&gt;
      &lt;script src="/js/controllers/mainController.js"&gt;&lt;/script&gt;&lt;!-- load controller --&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>movieApp.js</p>
  
  <pre><code> var movieApp = angular.module('movies-app', ['ngRoute', 'ngSanitize','mainController']);
  
   movieApp. config(['$routeProvider', '$locationProvider',    function($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(true);
    $routeProvider
      .when("/movie", {
              templateUrl : '/views/movie.html',
              controller : 'movieController'
      }) .otherwise({ redirectTo: "/" });
  
   }]);
  </code></pre>
  
  <p>mainController.js code</p>
  
  <pre><code> var mainController = angular.module('mainController', []);
  
       mainController.controller('movieController', ['$scope','$http',    function($scope, $http) {
      console.log("contro");
      $scope.test = "Yeppeee";
  }]);
  </code></pre>
  
  <p>When i am hitting <a href="http://localhost:3006" rel="nofollow">http://localhost:3006</a> a blank page appears, as expected. Edit URL to <a href="http://localhost:3006/movie" rel="nofollow">http://localhost:3006/movie</a>, console will show infinite loop of text "contro".</p>
  
  <p>Please help.</p>