4

我使用angular-app的安全功能,并且在 authorizationProvider 中发生了一些时髦的事情

angular.module('security.authorization', ['security.service'])

// You can add them as resolves to routes to require authorization levels
// before allowing a route change to complete
.provider('securityAuthorization', {

  requireUser: ['securityAuthorization', function(securityAuthorization) {
    return securityAuthorization.requireUser();
  }],

  $get: ['security', 'securityRetryQueue', function(security, queue) {
    var service = {

      requireUser: function() {
        //Stuff ...
        return true;
    };

    return service;
  }]
});

提供者将自己注入到属性“requireUser”中,该属性调用由 $get 工厂方法返回的函数。现在,当我尝试丑化这个(grunt-contrib-uglify)时,它失败了

  requireUser: ['securityAuthorization', function(securityAuthorization) {
    return securityAuthorization.requireUser();
  }]

Unknown provider: eProvider <- e. 我怎样才能缩小这个?我已经尝试过替代提供者声明(从 1.1.x 开始,可以像普通工厂一样声明提供者,即注入依赖项并让提供者成为一个函数),但这也不起作用,因为它在security.authorization 模块。

4

1 回答 1

4

grunt-contrib-uglify 的选项之一是mangle

尝试将此添加到您的 Uglify 配置中:

uglify: {
  options: {
    mangle: false
  }
}
于 2014-01-08T02:20:58.053 回答