嗨还有一个问题,我有下一个角度配置:
angular.module('ow', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/:placeId', {templateUrl: 'partials/menu.html', controller: MenuCtrl}).
when('/menu/:itemId', {templateUrl: 'partials/menu-details.html', controller: MenuItemCtrl}).
when('/look/refill', {templateUrl: 'partials/refill.html', controller: RefillCtrl}).
when('/look/orderCart', {templateUrl: 'partials/orderCart.html', controller: OrderCartCtrl}).
when('/lang/:lang', {templateUrl: 'partials/menu.html', controller: LangCtrl}).
when('/waiter/:redirect', {templateUrl: "???????", controller: WaiterCtrl}).
otherwise({redirectTo: '/0'});
}];
代替 ”?????” 我需要放置动态网址,尝试在控制器中执行此操作,例如:
function WaiterCtrl($routeParams, $location, sharedData, $http, $route) {
$http.get(config.urls.ajaxWaiter + "{\"p\":\"" + sharedData.getOrderCart().orderPlace + "\"}").success(function(dataDetails) {
if ($routeParams.redirect == "menu") {
$route.templateUrl = "partials/menu.html";
$location.path("/");
}
if ($routeParams.redirect == "menuDetails") {
$route.templateUrl = "partials/menu-details.html";
$location.path("/menu/" + sharedData.getMenu());
}
if ($routeParams.redirect == "orderCart") {
$route.templateUrl = "partials/orderCart.html";
$location.path("/orderCart");
}
if ($routeParams.redirect == "refill") {
$route.templateUrl = "partials/refill.html";
$location.path("/refill");
}
return $route.templateUrl;
});
}
但它不起作用......你能帮帮我吗?