0

So I'm playing around with learning angular and trying to make a project issue tracker, only I'm having problems with ngRoute and routing.

What I'd ideally like is a system whereby (say) issuetrack.com/projectX returns a view of all the issues for projectX, and issuetrack.com/projectX/XYZ returns a view of the specific issue with the related ID (XYZ).

I've setup my config as such:

tracker.config(['$routeProvider', '$locationProvider',
  function($routeProvider, $locationProvider) {
    $routeProvider.
      when('/', {
        templateUrl: 'static/partials/index_partial.html',
      }).
      when('/dashboard', {
        templateUrl: 'static/partials/dashboard.html',
        controller: 'DashboardController'
      }).
      when('/404', {
        templateUrl: 'static/partials/fourOHNOfour.html',
      }).
      when('/:project', {
        templateUrl: 'static/partials/project.html',
        controller: 'ProjectController'
      }).
      when('/:project/:issue', {
        templateUrl: 'static/partials/issue.html',
        controller: 'IssueController'
      }).
      otherwise({
        redirectTo: '/404'
      });

      $locationProvider.html5Mode(true);

  }]);

But every time I visit (say) localhost:8080/example/1 the page just hangs and becomes unresponsive. localhost:8080/example works completely fine though.

Is what I've done the right way to go about it, or is there another way my googling hasn't been able to find?

Thanks!

1 Answers1

2

Fixed! After several hours...

All you need is:

<base href="/" />

In the head of the index page where the ng-view is.