Reputation: 4552
I need to use $location.path() in the routes, but gets an "Unknown provider: $location" when trying to inject it.
What am I doing wrong? Thanks
myApp.config(['$routeProvider', '$locationProvider', '$httpProvider','$location', function ($routeProvider, $locationProvider, $httpProvider,$location) {
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:unpr] Unknown provider: $location
Upvotes: 0
Views: 373
Reputation: 5469
$locationProvider
is used for the configuration.
All the configuration for using $location
should be done with $locationProvider
. So you should not inject it in the config.Read about all the configurations available for $location service here:$locationProvider
Upvotes: 3