Javascript 角度布线
如何以只能获取template.html而不能获取template1.html的方式组织以下代码Javascript 角度布线,javascript,html,angularjs,templates,Javascript,Html,Angularjs,Templates,如何以只能获取template.html而不能获取template1.html的方式组织以下代码 App.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }); $routeProvider .wh
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: "/"
});
}]);
谢谢你的帮助 您应该重命名路由
.when('/collection:id', {
templateUrl: 'your/template.html',
controller: 'yourController'
});
})
您的问题不清楚,请使用
'/collection/:id'
和'/track/:id'
作为路线。