缩小时出现特定模块的未知提供程序错误

Getting an unknown provider error with a specific module when minifying

当我一起构建我的代码时,我在实例化主模块时遇到错误,因为它依赖于下面的模块,该模块在实例化时也遇到错误。据我所知,我正在尽一切努力确保模块安全,但我是否遗漏了什么?

angular.module('exceptionOverride').config(function($provide) {
    $provide.decorator('$exceptionHandler', ['$delegate', '$injector',function($delegate,$injector) {
        return function(exception, cause) {
            var $rootScope = $injector.get('$rootScope');
            var loggerService = $injector.get('loggerService');
            $delegate(exception, cause);
            exception.message = $rootScope.currentState + ': ' + exception.message;

            //send the exception off to the logging service
            loggerService.log(exception);
        };
    }]);
});

如果您认为需要,我可以为其他模块添加代码。

您还必须执行配置功能:(注意 ['$provide', function($provide){ ...

angular.module('exceptionOverride').config(['$provide', function($provide) {
    $provide.decorator('$exceptionHandler', ['$delegate', '$injector',function($delegate,$injector) {
        return function(exception, cause) {
            var $rootScope = $injector.get('$rootScope');
            var loggerService = $injector.get('loggerService');
            $delegate(exception, cause);
            exception.message = $rootScope.currentState + ': ' + exception.message;

            //send the exception off to the logging service
            loggerService.log(exception);
        };
    }]);
}]);