AngularJS Service Config value get destroyed on minification

后端 未结 3 1694
情话喂你
情话喂你 2021-01-11 11:02

Having some trouble with minification and AngularJS ;-(

I found this jsfiddle \"loading\" extender for HTTP request, through the AngularJS Wiki page.

It work

3条回答
  •  无人及你
    2021-01-11 11:08

    As strange as it might seem, you can also use inline annotation where you do the actual .push() to inject your dependencies on $q and $window i.e. instead of pusing a function() into $httpProvider.responseInterceptors you push an array:

    app.config(["$httpProvider", function($httpProvider) {
        $httpProvider.responseInterceptors.push(['$q', '$window', function($q, $window) {
            return function(promise) {
                return promise.then(function(response) {
                        $("#loader").hide();
                        return response;
                    },
                    function(response) {
                        $("#loader").hide();
                        return $q.reject(response);
                    });
            };
        }]);
    }]);
    

提交回复
热议问题