Search code examples
angularjsngrouteangularjs-1.6

how to avoid conflicts with angular router 1.6.x


i'm having trouble configuring my routers.

the router going to /:lang/:country & /:lang/:country/:city are not working. 1st three routes works OK, how cna I fix it?

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});
}]);

Solution

  • sorry guys, templateURL must be templateUrl lol