I'll try that. I'm trying to figure out a better way to get a mock data for e2e testing, $httpBackend doesn't seem to do what I want it to. I'm still figuring it out, though.
On Wed, Jan 15, 2014 at 12:23 AM, phindmarsh <[email protected]> wrote: > AFAIK you do need to use the $injector service, but only ask for $httpwhen > the interceptor is called (i.e. in your callback function), so in your > example: > > factory("interceptor", function ($q, $location, $injector) { > var $http; > return function (promise) { > $http = $http || $injector.get('$http'); // do it here instead > // do something with $http here... > return promise; > } > } > > I've used this approach before when depending on services in my > interceptors that depend on $http, seems to do the trick. > > > On Wednesday, 15 January 2014 05:39:54 UTC+13, Evgeni T wrote: >> >> The idea is to get a data from another source in certain cases, so I have >> this: >> >> factory("interceptor", function ($q, $location, $http) { >>> return function (promise) { >>> return promise; >>> } >>> } >> >> >> which fails with* [$injector:cdep] Circular dependency found: >> interceptor <- $http* >> >> Also tried to inject $injector and retrieve $http using that, with same >> results. Any ideas? >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/dTYSBPoQHN8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
