angular-http Questions

7

I'm learning angular through course and currently I'm learning about Interceptors. The angular version in the course isn't 17 but the one which I'm using in my local is. So, after 1st trying to imp...
Urinary asked 8/12, 2023 at 6:59

17

Solved

let httpParams = new HttpParams().set('aaa', '111'); httpParams.set('bbb', '222'); Why this doesn't work? It only set the 'aaa' and NOT the 'bbb' Also, I have an object { aaa: 111, bbb: 222 } How ...
Jilly asked 20/7, 2017 at 9:16

4

I use Observable.forkJoin() to handle the response after both HTTP calls finishes, but if either one of them returns an error, how can I catch that error? Observable.forkJoin( this.http.post<a...
Mischievous asked 29/6, 2018 at 14:18

2

HttpResponse class(in @angular/common/http) is a replace of class Response of @angular/http(which is deprecated). Looking at docs don't give much idea of how and where to use it! Moreover, I tried ...
Soleure asked 21/11, 2017 at 9:10

6

Solved

I'm wondering how to send an HTTP post request without a body (specifically in Angular). Here's what I'm doing now, but I'm getting the error Expected 2-3 arguments, but got 1). I realize the sec...
Message asked 22/11, 2017 at 18:44

3

In angular, we use HttpClient to make HTTP calls which return an observable, if we wanna use promises we can use lastValueFrom/firstValueFrom. Let's say we have: async getLast() { const get$ = thi...
Apposite asked 19/10, 2021 at 11:6

5

Solved

As the title states, I need to return multiple observables or maybe results. The goal is basically to load let's say a library list and then load books based on that library IDs. I don't want to ca...
Retinoscope asked 8/1, 2018 at 9:1

8

Solved

i am new to angular 5 . How to code a common function to show spinner for every HTTP request in angular 5.Please help me to implement this.

5

Solved

I am working on an angular2 project, I have a file in assets folder and I have created a button to download the file while running the app. I see there are quite a many solutions to the above pro...
Gileadite asked 18/6, 2018 at 10:33

2

Recently I have been using Interceptors with Angular HttpClient. I add headers corresponding to some HTTP GET methods and for some I do not need those headers. How can I tell my interceptor to co...

6

Solved

I have a service that will make a call to my rest service every 2 minutes. On my service I have the following function getNotifications(token: string) { const body = 'xxxxxxxxx=' + token; retur...
Alurd asked 28/6, 2017 at 17:37

3

I am trying to incorporate payment gateway into angular app, I found following JavaScript snippet provided by the payment partner for incorporation, I tweaked it by adding ngNoForm and got it worki...
Wille asked 25/11, 2018 at 21:20

4

Solved

I new to Angular 2 still learning I am trying to hit a URL with a get call but the get doesn't seem to go through even in browser's network I cannot find that get URL being called. The program is ...
Showman asked 29/12, 2016 at 13:59

7

Solved

My server returns this kind of header: Content-Range:0-10/0: I tried to read this header in angular with no luck: var promise = $http.get(url, { params: query }).then(function(response) { co...
Latter asked 2/3, 2015 at 8:42

4

Solved

i'm migrating from Http to HttpClient I'm used to add some headers to my http requests like the following with : import { RequestOptions, Request, RequestMethod, Headers } from '@angular/http'; ...
Lynwoodlynx asked 30/5, 2018 at 14:4

4

Solved

Object returned by $http.get has no methods. Example: I have my class model export class Lab { constructor( public id: number, public name: string, public description: string, public isActi...
Medlin asked 4/1, 2018 at 20:9

2

Solved

I see a lot of tutorials doing something like this: http.get("...").subscribe( success => console.log('hello success'), error => console.log('bye error') ); I don't know how this works, ...
Herringbone asked 6/6, 2017 at 9:5

5

Solved

I'm trying to do an API call from my angular app. What I want to do is send a post request to the API with a command param. I have done a lot of server-side testing as well as going through the out...
Paterson asked 15/6, 2017 at 13:55

6

Solved

How can I handle an HTTP error, e.g. 500, when using the AngularJS "http get then" construct (promises)? $http.get(url).then( function(response) { console.log('get',response) } ) Problem is, ...
Briarroot asked 13/6, 2013 at 5:58

2

Solved

In HttpClientModule, is there a method to pass headers and params to get request. import { HttpHeaders, HttpParams, HttpClient } from @angular/common/http'; const headers = { headers: new HttpH...

2

I am using Angular 4. Also used the http interceptor for any http request. https://angular.io/api/common/http/HttpInterceptor But I am using one of the post request using xmlHttpRequest for some f...
Penstock asked 2/4, 2018 at 8:55

2

Solved

I have an html structure with a component inside a component (forgot the proper word for it). working basicly like this (largely simplified): main html: <div *ngFor="let item of data"> &l...
Binominal asked 4/8, 2017 at 6:51

3

Solved

I am switching to use the new HttpClient in angular. The API am calling returns json data in one format. I want to take this data and transform it into a typescript model class suitable for the UI...
Mariellamarielle asked 4/12, 2017 at 11:33

0

I have implemented GET request in my application and able to fetch data for my Account Table in the AccountComponent. When I click on a particular row in the DataGrid , I get a POPUP window where ...
Canary asked 5/9, 2018 at 15:4

3

Solved

I am in the process of building a new app that requires authorization headers. Typically I use something very similar to the approach found in this scotch.io article. But it has come to my attentio...
Substantialize asked 27/7, 2017 at 16:0

© 2022 - 2024 — McMap. All rights reserved.