amichai amichai - 5 months ago 11
AngularJS Question

angular.module config using min.js files

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.

Answer

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([
      ...
   ]);
}]);
Comments