Vendor dependency injection and special case elimination

I use angular-app security features, and in 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; }] }); 

The provider introduces itself to the "requireUser" property, which calls the function returned by the $ get factory method. Now when I try to guess this (grunt-contrib-uglify), it fails in

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

with Unknown provider: eProvider <- e . How can I reduce this? I tried declaring an alternative provider (starting with version 1.1.x, you can declare suppliers as regular factories, that is, introduce dependencies and allow the provider to be a function), but this also does not work, since it looks for dependencies in the security.authorization module.

+4
source share
1 answer

One option for grunt-contrib-uglify is mangle

Try adding this to your Uglify configuration:

 uglify: { options: { mangle: false } } 
+4
source

All Articles