$routeProvider.when(..) not catching all URLs

setup: jade, angular, express, node.

In my routeProvider of angular, I am having some issues. I am requesting a url with a parameter which it is not catching.

var app = angular.module('myApp', ['ngRoute']);

     app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
      $routeProvider
         //... omitted some url/pages here
         //start of SPA
         .when('/dashboard/', {
            templateUrl: 'partials/index',
            controller: 'dashIndexCtrl'
        })
        .when('/dashboard/class/:id',{
            templateUrl: 'partials/class',
            controller: 'classCtrl'
        })
        .otherwise({
            redirectTo: '/'
        }); 

        $locationProvider.html5Mode(true);
    }]);

When I call localhost/dashboard/class/TEST

I get redirected to root.

I declare my routes on the server side as follows:

app.get('/dashboard', routes.dashboard);
app.get('/dashboard/partials/:name', routes.partials);
app.get('/api/class/:id', api.classGet);

My controller name matches up with the routeProvider. In which case the controller code goes as follows:

app.controller('classCtrl', function($scope, $http, $routeParams){
    $http.get('/api/class/' + $routeParams.id)
        .success(function(dataJson){
            console.log(dataJson);
        });
});

Why is routeProvider missing this url? I have set breakpoints within my controller so I am certain it is not being called. Also my partials/class.jade is not being called. Let me know if you need anymore code or directory information. Thanks in advance.


After further investigation:
If I go: localhost/dashboard/partials/class it will load that jade file. So it is definitely the controller.

Directory structure, I believe this is my issue now....

+---\
|   +---\views
    |   +---index.jade
    |   +---dashboard.jade
    |   +---\partials
        |   +---index.jade
        |   +---class.jade

Take a look into console and observe that AngularJS tries to load templates from /partials/index then from /dashboard/partials/index

Solution

set templateUrl path as /dashboard/partials/index in config section.

Reason: angular-route.js

templateUrl = $sce.getTrustedResourceUrl(templateUrl);

if (angular.isDefined(templateUrl)) {
    next.loadedTemplateUrl = templateUrl;
    template = $http.get(templateUrl, {cache: $templateCache}).
        then(function(response) { return response.data; });
}

There is no concatenation templateUrl with route path – just load tempalteUrl from Angular root of application.