0

I have an Angular App with a significant number of dependencies injected. In development I concatenate the sources (Grunt concat) and the application runs fine.

When I deploy the app I get an error:

http://errors.angularjs.org/1.3.0/$injector/unpr?p0=aProvider%20%3C-%20a

The only significant difference in the build process is that I grunt-ng-annotate and grunt-uglify the sources when I deploy.

I have made a number of module changes since last deploying the app and am finding it difficult to isolate the offending module.

Any suggestions please?

kpg
  • 7,644
  • 6
  • 34
  • 67
  • Possible duplicate? http://stackoverflow.com/questions/20340644/angular-unknown-provider-error-after-minification-with-grunt-build-in-yeoman-a – The Head Rush Nov 03 '14 at 17:28
  • Do you uglify before you annotate? That would cause the problem... – smithml Nov 03 '14 at 17:34
  • @smithml: no, I annotate first. – kpg Nov 04 '14 at 08:49
  • I noticed a recommendation from ng-annotate, to add the ng-strict-di directive to the minified source. I did that and now Angular gives me this infinitely more helpful message: "https://docs.angularjs.org/error/$injector/strictdi?p0=function(a" ! – kpg Nov 04 '14 at 09:45

1 Answers1

0

You're probably missing a dependency injection array somewhere, most likely because ng-annotate didn't figure it out. Your best way to debug this (since you're on >= 1.3.0) is to add ng-strict-di to your ng-app, and run it on your ng-annotate'd but not minified source (so tweak your build step). Now Angular will tell you what went wrong. I see from your comment that you tried ng-strict-di but because you used it with your minified source, the error message didn't help you much.

olov
  • 391
  • 3
  • 4
  • I see now that it wouldn't help to use ng-strict-di on the minified source - duh. The error message from Angular now really is infinitely more helpful than before and the problem is solved. – kpg Nov 05 '14 at 07:23