-1

我在配置我的路由器时遇到问题。

路由器去/:lang/:country&/:lang/:country/:city不工作。第一三条路线工作正常,我该如何解决?

app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
    $routeProvider
    .when('/', { // works
        templateUrl : 'templates/main.html',
        controller: 'MainCtrl'
    }).when('/:lang', { // works
        templateUrl : 'templates/main.html',
        controller: 'MainCtrl'
    }).when('/:lang/premium-benefits', { // works
        templateUrl : 'templates/premium_benefits.html',
        controller: 'PremiumBenefitsCtrl'
    }).when('/:lang/:country', { // NOT working
        templateURL : 'templates/destination.html',
        controller: 'DestinationCtrl'
    }).when('/:lang/:country/:city', { // NOT working
        templateURL : 'templates/destination.html',
        controller: 'DestinationCtrl'
    }).otherwise({
        templateURL : 'main.html'
    });

    $locationProvider.html5Mode({enabled: true, requireBase: true});
}]);
4

1 回答 1

0

对不起,templateURL 必须是 templateUrl 哈哈

于 2017-01-18T11:07:10.320 回答