Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for http interceptors #21

Closed
ffesseler opened this issue May 13, 2014 · 4 comments
Closed

Support for http interceptors #21

ffesseler opened this issue May 13, 2014 · 4 comments

Comments

@ffesseler
Copy link

Http interceptors are not annotated :-)

angular.module('myMod', [])

  .config(function ($httpProvider) {

    var interceptor = function ($rootScope, otherService) {
      return {
        'request': function (config) {
          otherService.doSomething();
          return config || $q.when(config);
        }
      };
    };
    $httpProvider.interceptors.push(interceptor);    
  });

It should output :

...
    var interceptor = ['$rootScope', 'otherService', function ($rootScope, otherService) {
      return {
        'request': function (config) {
          otherService.doSomething();
          return config || $q.when(config);
        }
      };
    }];
    $httpProvider.interceptors.push(interceptor);    
  });
@olov
Copy link
Owner

olov commented May 13, 2014

Thanks for filing the issue! I'll fix so that $httpProvider.interceptors.push(function($scope) {..}) is annotated properly.

You will also be able to do

var interceptor = /*@ngInject*/ function($scope) {..};
$httpProvider.interceptors.push(interceptor);

(@ngInject is a new feature coming in 0.9.0).

I hope to be able to put this issue to rest once I've put some kids to sleep. :)

@gabrielmaldi
Copy link

Can't wait for @ngInject! 😃

@olov olov closed this as completed in e4853ed May 13, 2014
@olov
Copy link
Owner

olov commented May 13, 2014

=> 0.9.0

@ffesseler
Copy link
Author

Wow, that was fast !
Thanks, will try the new version tomorrow :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants