How to correct the following code?

App.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }) $routeProvider .when('/', { templateUrl: "template/home.html", controller: "homeCtrl" }) .when('/artist', { templateUrl: "template/artist.html", controller: "artistCtrl" }) .when('/:collectionId', { templateUrl: "template/template.html", controller: "templateCtrl" }) .when('/:trackId', { templateUrl: "template/template1.html", controller: "templateCtrl" }) .otherwise({ redirectTo: "/" }) }]); 

It turns out that I can get only the template template.html and template1.html can not

  • What is the difference trackId and collectionId ? - Grundy
  • This is the id of two different objects - Max Vovk
  • one
    How to distinguish which route should include /1 ? - Grundy
  • if you yourself found the answer - it is worth adding it as your own answer. Or just delete the question - Grundy

1 answer 1

 App.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: "template/home.html", controller: "homeCtrl" }) .when('/artist', { templateUrl: "template/artist.html", controller: "artistCtrl" }) .when('/album/:collectionId', { templateUrl: "template/album.html", controller: "albumCtrl" }) .when('/video/:trackId', { templateUrl: "template/videoTemplate.html", controller: "videoTemplateCtrl" }) .otherwise({ redirectTo: "/" }) }]); 
  • Add a description of what the problem was and what it did to solve it - Grundy