0

I want to configure my angular module like this:

var app = angular.module('myModule', []).config(function ($sceDelegateProvider) {
   $sceDelegateProvider.resourceUrlWhitelist([
      ...
   ]);
});

But when I minify the js file the $sceDelegateProvider parameter is being convert to shorter name.

I didnt find a way to pass the parameter name as a string. (like it is in the module constructor)

Thanks.

amichai
  • 718
  • 9
  • 19
  • Possible duplicate of [Angular js App minification](http://stackoverflow.com/questions/25341645/angular-js-app-minification) – Yury Tarabanko Jun 14 '16 at 12:57

3 Answers3

2

Instead of passing a function into config, pass an array where the first variables are the parameter names as string and the last one is the function:

var app = angular.module('myModule', []).config(['$sceDelegateProvider' , function ($sceDelegateProvider) {
   $sceDelegateProvider.resourceUrlWhitelist([
      ...
   ]);
}]);
Tomer
  • 17,787
  • 15
  • 78
  • 137
0

You can add $sceDelegateProvider as a dependency in your config:

<your-module>.config(['$sceDelegateProvider', function($sceDelegateProvider){}]);

Then angular will inject $sceDelegateProvider to your config function mapping it to the parameter regardless of the parameter name.

amu
  • 778
  • 6
  • 16
0

Try

angular.module('myModule', []) 
    .config(['depProvider', function(depProvider) { 
        // ...     
      }])

See here for more details

https://docs.angularjs.org/guide/di

user1275105
  • 2,643
  • 5
  • 31
  • 45