Comments (7)
I'm going to close this assuming your issue was resolved
from ng-http-interceptor.
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.
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.
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.
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.
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.
Yeap. Thnx...
from ng-http-interceptor.
Related Issues (20)
- Get headers on response HOT 1
- Intercept responseError HOT 1
- ng build --prod fails when HttpInterceptorModule imported in app.module HOT 6
- Don't require RxJS version higher than what Angular requires HOT 2
- How to handle http request cancellation in http-interceptor HOT 3
- Interceptor not seeing all headers HOT 5
- (do) function not working in TypeScript 2.3.4 HOT 2
- IE11 Shims/Polyfills issue HOT 10
- Cancelling request type HOT 3
- Interceptors not running HOT 8
- Property 'do' does not exist on type 'Observable<Response>'. HOT 2
- Response interceptor is not called on error HOT 6
- Interceptors can only use in app moudle,could it import once use all moudle HOT 2
- Intercept header parameters at app run HOT 2
- Requests are send twice HOT 1
- Interceptor getting called only in preflight request not in subsequent call HOT 4
- Add support for new HttpClient HOT 5
- Interceptor is making service sending requests twice in lazy loaded module HOT 3
- keep seeing __extends is not defined HOT 2
- I think we should support angular8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-http-interceptor.