For questions directly related to the use of the Http service in Angular.
Questions tagged [angular2-http]
390 questions
0
votes
2 answers
How do I access the scope of a constructor wraping an angular2 observable?
I have the following code:
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions, URLSearchParams } from '@angular/http';
import { Observable } from "rxjs/Observable";
import { Document } from…

Archy
- 280
- 3
- 13
0
votes
1 answer
How can I run a method outside rxjs Observable when extending Angular2 HTTP Client?
i'm creating a HttpClient for my Angular2 typescript app and I'm stuck in error handler.
I want to emit an event when I catch a 401 error, and I'm able to catch the error but not to trigger my event, because the .catch needs to be attached to a…

gfviegas
- 58
- 4
0
votes
1 answer
Angular2 HTTP request fails
This is my first question here. I have a problem with the http requests on an API. When I make the request, the following error shows up on the console:
EXCEPTION: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only…

Thierry Henry
- 33
- 1
- 7
0
votes
1 answer
Angular2 authenticated web request get error message
I am working with a secured api that requires me to send an Authorisation header on each request, this is working fine. However I have an issue with the handling of 401 responses.
My call to the API is made as follows:
let headers: Headers = new…

ciantrius
- 683
- 1
- 6
- 21
0
votes
2 answers
Common pattern for returning a mapped object from Http service
One of my services has a method with this implementation:
public getCrawls(page: number): Observable{
return this._http.get(this._crawlsURL + page)
.map((res: Response) => {
return {
…

makeitmorehuman
- 11,287
- 3
- 52
- 76
0
votes
1 answer
Angular 2 custom http error handler service injection issue during bootstrap phase
Following an article on Angular 2 Custom http service here: which also leverages another custom http error service to handle http error codes and reload screen, Code for this service is here:
@Injectable()
export class HttpErrorHandler {
…

Nexus23
- 6,195
- 9
- 50
- 67
0
votes
1 answer
Error handling in Angular2
I'm working on an Angular 2 service returning data from a restful WebApi backend.
I'm trying to make it gracefully handle the service not being available however I'm getting unexpected information in the error responses.
Here's the code
update(fund,…

Mark
- 2,392
- 4
- 21
- 42
0
votes
1 answer
Angular 2 is not making http call from browser
I have a problem in angular 2 in typescript that browser is not making HTTP Call. I dont see any HTTp call in network section in browser.
the angular code works when i dont have any http call in service and it brings data when i use HTTP it doenst…

Shan Khan
- 9,667
- 17
- 61
- 111
0
votes
2 answers
Cancel http request
In jQuery ajax there's a way to abort ajax queries:
var xhr = $.ajax({ ... });
when user wants to abort the operation or navigates to other page in a single page app I can call
xhr.abort();
In angular2-http api I cannot find any possibility to…

Dániel Kis
- 2,341
- 5
- 28
- 51
0
votes
1 answer
Can't create 2 independent Observables with forkJoin
I have a function that takes a ID as parameter and makes HTTP calls, depending on the ID. It returns a Observable. I expected the calls with different parameters to be completely independent, but they influence each other.
I use
RxJS…

Manuel Huber
- 121
- 2
- 14
0
votes
1 answer
Angular 2 - displaying results after http request (Service)
I'm trying to iterate my results in my ngFor - it's not so intuitive like Angular 1. I've the following:
search.service.ts
import {Injectable} from 'angular2/core';
import {Http, HTTP_PROVIDERS, Response} from 'angular2/http';
import…

Marco Jr
- 6,496
- 11
- 47
- 86
0
votes
2 answers
Angular 2 Basic http service request
I'm stuck in something that's probably very basic... I just need to call a web server and grab my results. It used to be easy in Angular 1.
This is my component that's call the service:
import {Component, Input, OnChanges} from…

Marco Jr
- 6,496
- 11
- 47
- 86
0
votes
1 answer
Angular2 Heroes example doubles POST when combined with node.js server
I have set up the Heroes example up to step 10. Http Client. I've run the example to, which runs fine. Now, I'm replacing the "dummy" server with a Node.JS server on port 3002, replacing the _HeroesURL to "http:/localhost:3002/hero". The GET since…

Rik T. Hoff
- 1
- 2
0
votes
2 answers
Angular 2 error when injecting Http
I am trying to port a small Angular 1 app to Angular 2 and so far I've had issues with Http that I couldn't resolve. As soon as I inject HTTP_PROVIDERS, I get the following error:
Uncaught SyntaxError: Unexpected token < …

gen
- 19
- 5
0
votes
1 answer
Unable to see json data in angularjs 2 beta
I am using angular js 2 beta to consume a web service.
My web service is as follows,
This is my browser output when I hit http://localhost:8080/test
[{"name":"Bhasker"},{"name":"Aaron"}]
Following is my code,
app.component.ts
import {Component} from…

BhaskerYadav
- 569
- 3
- 24