获取错误未知提供者:uglify后的bProvider< - b

时间:2016-09-11 11:04:15

标签: angularjs gruntjs

获取未知提供者:bProvider< - b在uglify之后,我在我的公共directory.js文件中添加目录'slidermvHandle'后出现此错误。没有uglify它工作正常。尝试在gruntfile中禁用mangle选项但仍然不起作用。

JS

angular.module('app').directive('slidermvHandle', ['$document', function($document) {
    return {
        replace: false,
        restrict: 'AC',
        require: ['^slidermv', '^slidermvRange'],
        link: function(scope, element, attrs, _arg, transclude) {
            var handle, nextRange, range, slidermv, startPleft, startPright, startX;
            slidermv = _arg[0], range = _arg[1];
            nextRange = function() {
                return slidermv.ranges[slidermv.ranges.indexOf(range) + 1];
            };
            slidermv.handles.push(handle = {
                _width: 0,
                width: function() {
                    return this._width;
                },
                updateWidth: function() {
                    var _ref;
                    this._width = element.prop('clientWidth');
                    element.css({
                        float: 'right',
                        marginRight: -handle.width() / 2 + 'px'
                    });
                    return (_ref = nextRange()) != null ? _ref.adjustWidth(handle.width() / 2 + 'px') : void 0;
                }
            });
            startX = 0;
            startPleft = startPright = 0;
            return element.on("mousedown", function(event) {
                var mousemove, mouseup, _ref;
                if (nextRange() == null) {
                    return;
                }
                mousemove = function(event) {
                    return scope.$apply(function() {
                        var dp, _ref;
                        dp = (event.screenX - startX) / slidermv.elementWidth() * slidermv.pTotal();
                        // +/- 3, BOB'S ADJUSTMENTS
                        /*
                            if (dp < -startPleft + 3 || dp > startPright - 3) {
                                return;
                            }
                        */
                        // +/- 1, BOB'S ADJUSTMENTS
                        if (dp < -startPleft + 1 || dp > startPright - 1) {
                            return;
                        }
                        range.value(startPleft + dp);
                        if ((_ref = nextRange()) != null) {
                            _ref.value(startPright - dp);
                        }
                        element.css('z-index', '1000');
                        return slidermv.updateRangeWidths();
                    });
                };
                mouseup = function() {
                    $document.unbind("mousemove", mousemove);
                    element.css('z-index', null);
                    return $document.unbind("mouseup", mouseup);
                };
                event.preventDefault();
                startX = event.screenX;
                startPleft = range.value();
                startPright = (_ref = nextRange()) != null ? _ref.value() : void 0;
                $document.on("mousemove", mousemove);
                return $document.on("mouseup", mouseup);
            });
        }
    };
}]);

Gruntfile

// ...
uglify: {
    options: {
        mangle: false
    }
}
// ...

1 个答案:

答案 0 :(得分:1)

应用程序代码的某些部分没有使用显式依赖注释。您可以尝试enforce strict DI mode并运行未经授权的代码来验证哪些服务需要注释。