System.Web.Optimization making function argument names stay the same for certain functions

后端 未结 3 762
时光说笑
时光说笑 2021-01-06 03:52

With ASP.NET Bundling with a ScriptBundle

function StartController($scope, $location, $rootScope) {}

is transformed to

func         


        
3条回答
  •  -上瘾入骨i
    2021-01-06 04:21

    Angular provides a way to deal with minification. If you are defining a controller you can rewrite your code as:

    YOUR_APP_MODULE.controller('CONTROLLER_NAME', ['$scope', '$location', '$rootScope', function($scope, $location, $rootScope){
        // DO STUFF
    }]);
    

    On Minification, this will become:

    YOUR_APP_MODULE.controller('CONTROLLER_NAME', ['$scope', '$location', '$rootScope', function(n, t, i){
    }]);
    

    You can do similar stuff with other angular components also.

提交回复
热议问题