Search code examples
javascriptangularjsroutesroute-provider

Why is my $routeprovider empty


I have a question about the $routeProvider. In my code I have a $routeProvider.

$routeProvider
        .when('/language/:countryCode', routing)
        .when('/promotion/:promotionCode', routing)
        .otherwise(routing);
}]);

the 'routing' variable directs to a controller called registrationController. There, I have this initialise method.

$scope.initialise = function () {       
    console.log($routeParams);
}

When I go to my browser and type in the URL:

mydomain/registration#/promotion/:free

The console prints out

Object {promotionCode: ":free"}

But now when I change that same URL to

mydomain/registration#/language/:US-EN

The console prints out and empty object.

Does anyone know why, even though the routing is exactly the same, it doesn't recognize the language route?


Solution

  • The code I gave in the question itself was correct. I forgot to compile and build the project. I wasn't aware that needed to be done for javascript changes.