Reputation: 7966
I am getting this error intermittently:
Error: [$injector:unpr] Unknown provider: undefinedProvider <- http://errors.angularjs.org/1.2.16/$injector/unpr?p0=undefinedProvider%20%3C-%20
It can be repeated up to 10 times.
It seems to happen the first time the page is loaded into the browser. Usually, when I refresh the page, the messages do not appear.
It's not a new application. It has been working for some time, but I have made changes. The fact that the symptom appears intermittently is making it difficult to isolate the change that caused it.
What is puzzling me is the undefinedProvider
. Any suggestions on how to find the provider name would be welcome!
I am using the unminified version of AngularJS 1.2.16.
I have done the usual things like using the array syntax.
I know this is not much to go on, but I thought I would check if anybody has experienced something similar before cutting the code down to a plunker.
One thing I added fairly recently was to pass some config data in via an ejs variable from the node server (as recommended by the Google talk on 'Massive Apps' from ng-conf). It was working fine, but I wonder if there is some timing issue. Here's a snippet:
.config(['$provide', function ($provide) {
var profile = angular.copy(window.activeProfile);
$provide.constant('Config', profile.config);
console.log("Config:", profile.config);
}])
.run(['$rootScope', '$state', '$window', 'Config', function ($rootScope, $state, $window, Config) {
The config is logged as I expect.
Upvotes: 2
Views: 1611
Reputation: 10847
There are a bunch of trouble shooting items located here
Did you define your module more than once? Make sure you don't angular.module('name', []);
twice with a array as the second argument.
Interestingly, calling $injector.get(key);
with undefined as your key will give you this same error, but the callstack will easily point you to that.
Upvotes: 0
Reputation: 7966
This appears to be a bug in ngAnimate 1.2.16 and later(or incompatibility with AngularStrap?). On earlier versions my app works, later versions give me this:
Error: [$injector:unpr] Unknown provider: undefinedProvider <-
http://errors.angularjs.org/1.3.0-beta.5/$injector/unpr?p0=undefinedProvider%20%3C-%20
at http://code.angularjs.org/1.3.0-beta.5/angular.js:78:12
at http://code.angularjs.org/1.3.0-beta.5/angular.js:3709:19
at Object.getService [as get] (http://code.angularjs.org/1.3.0-beta.5/angular.js:3836:39)
at http://code.angularjs.org/1.3.0-beta.5/angular.js:3714:45
at Object.getService [as get] (http://code.angularjs.org/1.3.0-beta.5/angular.js:3836:39)
at lookup (http://code.angularjs.org/1.3.0-beta.5/angular-animate.js:409:36)
at animationRunner (http://code.angularjs.org/1.3.0-beta.5/angular-animate.js:458:17)
at performAnimation (http://code.angularjs.org/1.3.0-beta.5/angular-animate.js:862:22)
at http://code.angularjs.org/1.3.0-beta.5/angular-animate.js:623:13
at Scope.$digest (http://code.angularjs.org/1.3.0-beta.5/angular.js:12308:36)
I am not using ngAnimate directly, only through AngularStrap and Toaster directives.
My solution is to revert to Angular and angular-animate version 1.2.15.
Upvotes: 2