title: Making Angular routes work with Express routes
body: <p>I've got in impasse with setting Angular routes to work with Express. </p>
  
  <p>I tried to do like here <a href="https://stackoverflow.com/questions/25235384/express-4-nodejs-angularjs-routing">Express 4, NodeJS, AngularJS routing</a> but that did not work. The static index.html serves each time the url changes, but the Angular does not catch the partial.</p>
  
  <p>In my Express I have the following code:</p>
  
  <pre><code>var express = require("express");
  var app = express();
  app.use(express.static(__dirname + '/app'));
  app.use("*",function(req,res){
      res.sendFile(path.join(__dirname,"app/index.html"));
  });
  app.listen(1337, function(){
      console.log("Server is listening on port 1337");
  });
  </code></pre>
  
  <p>And in my Angular app, I have the following: </p>
  
  <pre><code>var app = angular.module("myapp",["ngRoute","appControllers"]);
  
      app.config(["$routeProvider","$locationProvider",function($routeProvider,$locationProvider){
              $locationProvider.html5Mode(true);
              $routeProvider
                      .when("/list",{
                          templateUrl: "/partials/users.html",
                          controller: "userListCntr"
              })
                      .when("/edit", {
                          templateUrl: "/partials/edit.html",
                          controller: "userEditCntr"
              })
                      .when("/register", {
                          templateUrl: "/partials/register.html",
                          controller: "registerCntr"
              })
                      .when("/login", {
                          templateUrl: "/partials/login.html",
                          controller: "registerCntr"
              });
  
      }]);
  </code></pre>
  
  <p>I don't have any errors in my browser console. The html inspector shows:
      <code>&lt;!-- ngView:  --&gt;</code> so the directive is kind of initialized. </p>
  
  <p>And dependency list:</p>
  
  <pre><code>dependencies": {
      "angular": "1.3.x",
      "angular-mocks": "1.3.x",
      "jquery": "1.10.2",
      "bootstrap": "~3.1.1",
      "angular-route": "1.3.x",
      "angular-resource": "1.3.x",
      "angular-animate": "1.3.x"
    }
  </code></pre>
  
  <p>here is my file structure:</p>
  
  <pre><code>--app (angular app)
     --components
     --js
     --css
     --img
     --assets
     --partials
     --index.html
  --node-modules
  --server.js (here express settigs are)
  </code></pre>
  
  <p>ALso, I made changes as follows to account for all static resources, but still does not work:</p>
  
  <pre><code>app.use(express.static(__dirname+ "/app"));
  app.use('/js', express.static(__dirname + '/app/js'));
  app.use('/dist', express.static(__dirname + '/../dist'));
  app.use('/css', express.static(__dirname + '/app/css'));
  app.use('/assets', express.static(__dirname + '/app/assets'));
  app.use('/components', express.static(__dirname + '/app/components'));
  app.use('/img', express.static(__dirname + '/app/img'));
  app.use('/partials', express.static(__dirname + '/app/partials'));
  
  app.all('/*', function(req, res, next) {
      // Just send the index.html for other files to support HTML5Mode
      res.sendFile('/app/index.html', { root: __dirname });
  });
  </code></pre>
  
  <p>Please, help, because I can't find a solution. Thanks!</p>