0

I want to mangle my AngularJS file, and it works for almost the whole part. However, when I click through the app and navigate to the only part that uses ngLazyBind and angular-history, I get the following issue: Error: [$injector:unpr] Unknown provider: aProvider <- a <- $lazyBind .

I am using ngMin in hopes that this kind of stuff wouldn't happen. When I set uglify's mangled property to false, this issue goes away.

Another little note - injecting $lazyBind into a controller is what causes the error. I can include lazyBind in the app without issue, but when I inject $lazyBind into a controller the error arises.

The reason I mention angular-history is if I completely eliminate lazyBind, the exact same error appears with Error: [$injector:unpr] Unknown provider: mProvider <- m <- History.

Zambezi
  • 767
  • 1
  • 9
  • 19
  • Either you're using a minified version of angular or a minified version of your code. Either way, don't do it in development, or else you get these comprehensible errors. – haimlit Jun 12 '14 at 21:55
  • It's not for development itself - I'm trying to get a working production prototype out. – Zambezi Jun 13 '14 at 15:10

1 Answers1

0

It doesn't look like the 2 libraries are minification-safe...

In angular-history line 88...

angular.module('decipher.history', ['lazyBind']).service('History',
    function ($parse, $rootScope, $interpolate, $lazyBind, $timeout, $log,

From the error message, it looks like $parse was renamed to m and angular wasn't able to resolve it.

Same thing with ngLazyBind line 89...

app.factory("$lazyBind", lazyBindProvider);
Anthony Chu
  • 37,170
  • 10
  • 81
  • 71
  • I agree - they don't look minification safe. However, I thought that ngMin was supposed to deal with it. Do you have any suggestions on how to fix it? – Zambezi Jun 13 '14 at 15:11