Linked Questions
20 questions linked to/from What is httpinterceptor equivalent in angular2?
0 votes
1 answer
760 views
BaseResponseOptions angular2 Handling global error [duplicate]
Hi I want to handle a global 401 error after an http request with angular2. I want to extend BaseResponseOptions class. This is the corret way?
396 votes
23 answers
618k views
Angular - Set headers for every request
I need to set some Authorization headers after the user has logged in, for every subsequent request. To set headers for a particular request, import {Headers} from 'angular2/http'; var headers = new ...
78 votes
7 answers
53k views
Prevent IE11 caching GET call in Angular 2
I have a rest endpoint that returns a list on a GET call. I also have a POST endpoint to add new items and a DELETE to remove them. This works in Firefox and Chrome, and the POST and DELETE work in ...
47 votes
3 answers
20k views
Handling refresh tokens using rxjs
Since i've started with angular2 i have setup my services to return Observable of T. In the service i would have the map() call, and components using these services would just use subscribe() to wait ...
15 votes
3 answers
11k views
Interceptors in Angular2
I am trying to build a demo app on Angular2.beta.0 which would have login mechanism and then all the other API calls would have the acquired session token sent via the headers. In angular 1x, I could ...
4 votes
1 answer
5k views
Angular 2 - How to get Observable.throw globally
How, I want to handle http errors (specially status 401) globally. I know I can do something like that getCompanies() { return this.http.get('https://angular2.apispark.net/v1/companies/') ....
2 votes
3 answers
3k views
Call common function before and/or after HTTP request in angular 2
I need to setup common loader into entire angular2 project. So i just want to do is when my new http call generate either it's GET, POST, or PUT then before request sent loader is appear. Once http ...
1 vote
1 answer
2k views
How to create interceptors in Angular2?
I am building my first larger app in Angular2, and I am wondering how can I build something which will be an alternative to Angular1 interceptors? I was digging the Internet, and found out that I can ...
2 votes
0 answers
4k views
angular 4 provider and Dependency Injection issue with service object in constructor of service
I am working with angular 4. I am newbie in angular. I have problem with service object couldn't find in another service. I am working for 401 status error to get refresh token on token expired. I ...
2 votes
2 answers
1k views
Intercept all HTTP requests from angular2
I'm looking for a way to intercept all HTTP requests made by the angular and add some headers. In releases prior to angular2 RC5 (before NgModule) was that way, for example: class MyOptions extends ...
0 votes
1 answer
2k views
How to Send timezone info to server with http request?
I would like to do some timezone specific date manipulation on server. But I don't want to send the timezone via request payload for each and every http request. Any other work around there for ...
1 vote
3 answers
2k views
How to implement Interceptor for refreshing token when api response status is 401 in angular 2
Am New to Angualr 2 , am facing problem while refreshing the Token when api response is Non authorized (401 ) error. What want implement this concept by using interceptor . Please suggest any inputs ...
0 votes
1 answer
744 views
Intercepting errors in Angular2 - issue with catch
I was following this answer by Thierry Templier, but run into some troubles when defining error interceptors (other interceptors are working). I have the following: get(url: string, options?: ...
0 votes
1 answer
1k views
Change the request body in interceptor angular2
How can I change the request body type of post in interceptor? For example I have this object: {"UserName":"213243546","Password":"89876"} that I want to change all 3 to e but it is not only in this ...
0 votes
1 answer
503 views
How return a request inside a promise
I am using ionic 2 / angular 2. I need to do a http request, but before I have to get a token using Ionic Storage. I created a class ApiRequest for that import {Http, Headers, RequestOptions} from '...