For questions directly related to the use of the Http service in Angular.
Questions tagged [angular2-http]
390 questions
0
votes
1 answer
Angular2 Http Request returns Observable without map method
I have setup my application with HTTP_PROVIDERS
bootstrap(AppComponent, [
HTTP_PROVIDERS,
ROUTER_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy }),
PostService
]);
and my service like
@Injectable()
export class…

VuesomeDev
- 4,095
- 2
- 34
- 44
0
votes
1 answer
Routing with http calls in Angular 2
I am looking for the best way to route between my components in Angular 2. In my application I go from page to page by submitting a form:
Page A displays a form and a submit button to go to next step,
Data filed by the user in page A form are used…

j3r6me
- 798
- 1
- 5
- 21
-1
votes
1 answer
HTTP Response handling in angular 2 application
Working with angular 2 HTTP PUT request. I have a component and service. In the component I make request to update the attributes of account. It then calls the Service to update the account through an API. On response I am trying to receive the…

Nandini
- 31
- 8
-1
votes
1 answer
Angular 2/4: Is it safe to use Http.Get (with parameters) when calling WebApis?
In Angular, is it secure to use Http Get when calling Web API, supplying password in the field? Or is it more secure if one uses Http Post?
The following is an example on how to perform Http.get in angular
http.get(baseUrl + 'api/GetAddressCount')
…

user1034912
- 2,153
- 7
- 38
- 60
-1
votes
1 answer
angular 2 how to get returned data from .post http angular2
I am using HTTP angular2 to post some data. It is working ok, I can send data from angular2 service , receive it in my express backend.
I want to get the returned data from express. If i use .get .map((res:Response) => res.json()) works, but it is…

raju
- 6,448
- 24
- 80
- 163
-1
votes
2 answers
Reuse the object returned from HTTP response without making another API call in Angular 4
I am using promise to retrieve a User-Details object in a Angular 4 app using Typescript.
Now, I am using part of that object at two different places in my application using simple get request. Something like this :
private _firstName:…

Azim Saiyed
- 392
- 1
- 5
- 15
-1
votes
1 answer
Return list from TypeScript function doing HTTP GET
I have a procedure:
products = []
getAllProducts(){
this.http.get
(this.baseUrl + '/products').map((resp:Response) => resp.json())
.subscribe(
(data) => {
const products = data;
this.products = products;
…

Dawid
- 153
- 3
- 18
-1
votes
1 answer
Ionic2 Angular2 HTTP error
when I execute POST, PUT or DELETE request, I track two http calls
the first Request Method:OPTIONS and second with my request method (Status Code:500)
PS: I haven't problem with GET method.
Thank you
@Injectable()
export class UtilisateurService…

HichMAN
- 37
- 6
-1
votes
1 answer
Angular2 Http.get Send two request
i have simple authentication service im using jwt token and after if ill need user detail for check authorization header and send request api end point but angular 2 request send first request Header empty key but second correct header let me…

Serkan Dayicik
- 41
- 7
-1
votes
1 answer
InMemoryBackendService error collection.reduce is not a function
I am trying to mock a login component that does an http post with credentials to an auth endpoint that returns a json object containing a token and some other info.
Getting a "500 Internal server error" response, upon further inspection I see more…

JBeckton
- 7,095
- 13
- 51
- 71
-2
votes
1 answer
when ad add code on my file as it is on video i get error "./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http'"
i am new in angular world. i trying to learn this framework but it is so HARD!... so in my first example i got error:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from…

გენო მუმლაძე
- 102
- 2
- 18
-3
votes
2 answers
Angular2 http : Not able to Understad why I am getting user array with one piece of code and user object at a time with the another?
first :
this.http.get('http://localhost:3000/users).
map(users=>users.json())
.subscribe(
users=>{
let user : User=users[0];
console.log(user);
})
second…

prakash kumar
- 520
- 1
- 5
- 16
-3
votes
1 answer
Angular 2/4 | How can i get the API data with Token
Good day,
How can i get the api data with token using angular 2/4?
Here is my code:
import { Component, ViewEncapsulation } from '@angular/core';
import { Http, Response } from '@angular/http';
import 'rxjs/add/operator/map';
@Component({
…

Jydon Mah
- 383
- 1
- 9
- 29
-3
votes
2 answers
Send data to server and wait an answer using http
I want to send some data to the server and wait an answer from it in my onSelected method. Do you know how to do this with Angular using http? Here is my code:
import {Http, Headers} from '@angular/http';
import { CompleterService, CompleterData…

Alex99
- 67
- 1
- 12
-3
votes
1 answer
Can't get data from JSON file
I can't get JSON local file Angular HTTP service. I have these codes:
import {Injectable} from '@angular/core';
import {Http, Response} from "@angular/http";
import 'rxjs/add/operator/map'
@Injectable()
export class ApiService…

tetra master
- 537
- 8
- 13