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

后端 未结 4 1407
一整个雨季
一整个雨季 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:50

    Angular doesn't always work well with minification.

    If you as an example write this:

    angular.controller("MyCtrl", function ($scope) {...});
    

    Then the $scope would be changed to something meaningless during minification.

    If one instead changes that to:

    angular.controller("MyCtrl", ["$scope", function (s) {...}]);
    

    Then it doesn't matter what the first argument in the function is called (here s), as long as the string is "$scope".

    See this: https://docs.angularjs.org/tutorial/step_05#a-note-on-minification in the documentation for more details.

    If you want more help, you have to post the code in question, not just the error.

提交回复
热议问题