简体   繁体   中英

Error:: [$injector:unpr] when trying to setup routing

Trying to setup a simple authentication for my angularjs app. When I debug the app.js in line 20 I receive this error:

Error: [$injector:unpr] http://errors.angularjs.org/1.2.16/$injector/unpr?p0=configProvider%20%3C-%20config

Anyone have any idea what is goin wrong here?

here is the plunkr: http://plnkr.co/edit/k0dfl8ZFSCpYEBhuZMBf

A great place to start with these kinds of issues is to use the un-minified version of Angular (angular.js instead of angular.min.js). Then you get this slightly more readable error message:

Error: [$injector:unpr] Unknown provider: configProvider <- config

That lead us to your navbarController.js where you're injecting the service config which hasn't been defined (thus the "Unknown provider" error):

var NavbarController = function ($scope, $location, config, authService) {

...

NavbarController.$inject = ['$scope', '$location', 'config', 'authService'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM