Coder Social home page Coder Social logo

Comments (7)

gund avatar gund commented on May 16, 2024 1

I'm going to close this assuming your issue was resolved

from ng-http-interceptor.

gund avatar gund commented on May 16, 2024

Did you go through the example use case?
You can set interceptors that way from any component or service you want.

from ng-http-interceptor.

teswar avatar teswar commented on May 16, 2024

Yes, did go through this example , but there you are adding/removing interceptors probably in a service level.
I think it would be better to configure the interceptors in the module level, while the HttpInterceptorService is being injected. As you have stated in your concept or as here

from ng-http-interceptor.

gund avatar gund commented on May 16, 2024

The thing is services should always remain as singletons meaning they are only of one instance no matter where you are injecting it (any component or service).

That said all registered interceptors always global.

from ng-http-interceptor.

teswar avatar teswar commented on May 16, 2024

I understand the singleton concept.
In my project there a independent service to each resources, where HttpInterceptorService is being injected via constructor and most of the API calls need OAuth Token attached to the header.
The problem is I can't be certain which service will always be firstly created, so that the interceptors can be configured in that service.
Else I have to configure in the base-service, which is inherited by all my resource-services.

But I am able to do this in the main app's module level. I will not have to be worried about these rite ?

from ng-http-interceptor.

gund avatar gund commented on May 16, 2024

I'm sure you can do that from main app.

However I'm not sure I can see the problem why you ever should be worried about services construction order?
Can you please provide some example use case?

from ng-http-interceptor.

teswar avatar teswar commented on May 16, 2024

Yeap. Thnx...

from ng-http-interceptor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.