btford/ngmin

Support for http interceptors

homanchou opened this issue · 8 comments


App = angular.module("myApp", ["ngGrid", "ngAnimate",  "ui.router", "ui.bootstrap"]);

//The following broke during grunt build

App.config(function($httpProvider) {

    $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";

    $httpProvider.interceptors.push(function($q) {
     ....
    });

    $httpProvider.interceptors.push(function($q, $rootScope) {
      ....
    });

  }
]);

// we resorted to this format to get it to minify correctly

App.config([
  "$httpProvider", function($httpProvider) {

    $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";

    $httpProvider.interceptors.push(['$q', function($q) {
     ....
    }]);

    $httpProvider.interceptors.push(['$q','$rootScope', function($q, $rootScope) {
      ....
    }]);

  }
]);

+1, I just lost hours figuring this out…

+1, I also lost two hours for figuring this out...

+1

Oh.. thanks for this issue. I couldn't figure out what was breaking my build.

👍

few more hours lost here..

spending hours on this!!! please fix!!

so does anyone know of any hip, angular grunt tasks that account for these trivial issues before someone like me has to be all proper with dept injections?

Please try https://github.com/olov/ng-annotate. ngmin is now deprecated: #93

If your issue isn't resolved there please open an issue at https://github.com/olov/ng-annotate/issues

If you really want ngmin to fix this issue, feel free to fork it and use that.