Error after Minification of angular js. Error: [$injector:unpr] Unknown provider: eProvider <- e <- makeErrorsDirective

后端 未结 4 1434
一整个雨季
一整个雨季 2021-01-05 00:48

I used Gulp to minify my entire js files. Once minified I got an error like the following:

[$injector:unpr] Unknown provider: eProvider <- e <- makeE         


        
4条回答
  •  执念已碎
    2021-01-05 00:55

    I had this same issue, even when I use gulp-ng-annotate, but it only happens occurs for $stateProvider and ngDialog resolves:

    $stateProvider
      .state('orders', {
        url: '/orders',
        templateUrl: 'templates/orders.html',
        controller: 'OrdersController as vm',
        resolve: {
          authenticate: function (Auth) {
            return Auth.getAuthResolve();
          }
        }
      });
    

    Resolve needs to be written like this:

        resolve: {
          authenticate: ['Auth', function (Auth) {
            return Auth.getAuthResolve();
          }]
        }
    

    So it feels that ng-annotate does not inject the array into resolves, but only to controller/service/factory constructors.

提交回复
热议问题