Linked Questions

0 votes
1 answer
760 views

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?
Marco Moretti's user avatar
396 votes
23 answers
618k views

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 ...
Avijit Gupta's user avatar
  • 5,786
78 votes
7 answers
53k views

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 ...
cmaynard's user avatar
  • 2,870
47 votes
3 answers
20k views

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 ...
Davy's user avatar
  • 6,451
15 votes
3 answers
11k views

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 ...
hussainb's user avatar
  • 1,306
4 votes
1 answer
5k views

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/') ....
Gustavo Lira's user avatar
2 votes
3 answers
3k views

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 ...
Jitendra Solanki's user avatar
1 vote
1 answer
2k views

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 ...
uksz's user avatar
  • 18.4k
2 votes
0 answers
4k views

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 ...
herr's user avatar
  • 847
2 votes
2 answers
1k views

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 ...
Fernando Leal's user avatar
0 votes
1 answer
2k views

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 ...
chenk's user avatar
  • 482
1 vote
3 answers
2k views

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 ...
M Raju's user avatar
  • 11
0 votes
1 answer
744 views

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?: ...
uksz's user avatar
  • 18.4k
0 votes
1 answer
1k views

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 ...
nima Sr's user avatar
0 votes
1 answer
503 views

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 '...
Gabriel's user avatar
  • 365

15 30 50 per page