【发布时间】:2017-05-31 18:56:42
【问题描述】:
我目前正在处理一个 MEAN 堆栈项目,并试图让一个特定的模板显示在特定的 url 上。
目前,如果用户转到 www.myurl/catalog,它会加载 catalog.html 模板,就像任何 /catalog?catagory=productType url 一样。
我希望它在用户转到 /catalog?category=specificProductType 时加载catalogSpecific.html 模板。目前,catalog.html 模板取代了 catalogSpecific.html 模板。我找不到有关此特定问题的太多信息,因此我们将不胜感激。
目前我的路线如下所示:
app/front/app.js
angular.module('app', ['ngRoute',
'app.LandingModule.controller',
'app.CatalogModule.controller',
'app.ProductModule.controller',
'app.HeaderModule.directives',
'app.FooterModule.directives'
])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'html/landing.html',
controller: 'LandingController'
})
.when('/catalog', {
templateUrl: 'html/catalog.html',
controller: 'CatalogController'
})
.when('/catalog?category=specificProductType', {
templateUrl: 'html/catalogSpecific.html',
controller: 'CatalogController'
})
.otherwise({
redirectTo: '/'
});
}]);
【问题讨论】:
标签: javascript angularjs routes