Questions tagged [angular4-httpclient]

Use this tag only for questions related to the HttpClient service included in HttpClientModule of Angular version 4

The HttpClient service is included in HttpClientModule of Angular version 4. HttpClient can be used for establishing an HTTP communication performing requests and processing responses.

220 questions
3
votes
1 answer

Angular 4 : Send custom headers with http requests

In Angular 4, I am unable to send custom header with http requests. I have tried to send header using following code: let response = this.http.post(environment.serverUrl + url, data, this.getHeaders()) .map((response: Response) =>…
Suvonkar
  • 2,440
  • 12
  • 34
  • 44
2
votes
1 answer

response of a request not being same when being accessed in subsrcibe

I have an angular function which makes an HTTP call to a certain end point and i am subscribing the response. But there is a very strange behavior i am getting noticing that when i inspect response of the request in network tab it is correct but…
2
votes
1 answer

Send Array in Multipart/formdata in angular 7

I am trying to send a JSON array inside formdata and also, other form fields with it. This Json array's fields are generated dynamically. However, it is giving me error 500. This is how i have to send.…
tanmay parmar
  • 279
  • 1
  • 4
  • 15
2
votes
4 answers

How to use ForkJoin for sequence of http requests Angular 4

I have a function which makes two http calls, the input of second http depends first http response and I need the two results to be returned at the same time. I have the below code which throws the error SomeMethod(): Observable { let…
thecrusader
  • 301
  • 6
  • 18
2
votes
2 answers

Cannot instantiate cyclic dependency! AuthService ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1

getting error compiler.js:11472 Uncaught Error: Provider parse errors: Cannot instantiate cyclic dependency! AuthService ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1 at…
2
votes
3 answers

How to wait and get response for each HttpClient service call from a loop in Angular 4

I have a situation where I need to run a loop and fetch respective items' description. Then along with the item Ids and other information I have to include the fetched description in a datatable. addDescription(){ this.arrayOfItems.forEach(element…
2
votes
2 answers

ASP NET Core 2.0 + angular 4 json response handle

I have the ASP NET Core 2.0 project. For client side I use angular 4. I try to implement api request handle on client side. So, in my controller I have public IActionResult AddWorkSchedule(int employeeId, [FromBody] WorkScheduleBaseRequest…
JohnyMotorhead
  • 675
  • 1
  • 9
  • 18
2
votes
3 answers

Multiple data post to server in Angular 4

I'm building some application that need to be able to run offline, so when it's offline i cache every data post in localstorage, and when the browser detect that it's online, i read that cache and begin pushing all data to the server using…
2
votes
2 answers

"Http failure response for (unknown url): 0 Unknown Error" Angular

I try use service httpClient post but I have this error: code service: constructor(private http:HttpClient) { } Login(data) { let headers: any = new HttpHeaders(); …
sf_2018
  • 105
  • 1
  • 3
  • 9
2
votes
2 answers

Getting Syntax error in Response data in angular4 while trying to download an excel file

I'd like to download an excel file by clicking a button in my angular Page. When a user clicks the button, the click event triggers a service-method call: downloadExcel(){ this.componentService.getExel().subscribe( data => { …
2
votes
2 answers

JWT token missing using http get method in angular 4

I am using HTTPClient Module of Angular 4 for retrieving data from a database. The corresponding service has the following method, getPosts() { const httpHeaders = new HttpHeaders().set('Content-Type', 'application/json'); //…
Anil
  • 1,748
  • 8
  • 32
  • 67
2
votes
2 answers

CORS issue after adding interceptor in angular

I was sending API request from angular it had CORS issue so i fixed it in server using below code(laravel).
Abhishek
  • 1,008
  • 1
  • 16
  • 39
2
votes
1 answer

Angular 5 HttpClient response headers does not contain custom headers

I have API made in Nodejs, after login i send the auth-token (x-auth header) in the response on successful login. When i hit the webservice from postman i am able to see the x-auth header but not in Angular 4 I am using HttpClient , not…
Gaurav_soni
  • 6,064
  • 8
  • 32
  • 49
2
votes
3 answers

Unable to navigate from one page to another page in angular 5

this is my app.component.html file

PL Auth

Moulali
  • 465
  • 1
  • 6
  • 17
2
votes
0 answers

How to send JavaScript or Typescript object in HttpParams in Angular?

I would like to submit a complex model to my API. The model do contains objects and/or an array. Using HttpParams, I could submit simple key, value object as follows: let httpParams = new HttpParams() .set('name','Foo') …
Bellash
  • 7,560
  • 6
  • 53
  • 86