Questions tagged http

Explore the latest questions and answers asked by our top developers.

Need Angular 8 canActivate to return Observable<boolean> of a Subject

So I have an Angular 8 application that uses cookies to handle authentication (Laravel server using Laravel Sanctum). Because I am using cookies and I dont store any user data/tokens in localStorage, I have to fetch the current user from my server every time my app initializes using a stored cookie. auth.service.ts export class AuthService […]

By amcardwell
Published
Categorized as angular, http, javascript, rxjs Tagged , , ,

How to properly cancel a HTTP request with Angular and PHP

Hi I currently have a http request like this in Angular: data = await this.http.post(Globals.API_BASE_URL+’rca/obtener_equipos’, {subsistemas}) .pipe( takeUntil(this.ngUnsubscribe) ).toPromise(); then I have a while in my PHP server for this task: while (1) { Echo "n"; if (connection_status()!=0){ die; } But this didnt work, the server stuck until the task ends. pd: I checked with […]

By Cristofer Fuentes
Published
Categorized as angular, http, php Tagged , ,

Angular – HttpClient – Duplicate request is always performed when the request throws an error

I have a weird problem. I have a service, which gets data from the Back-end and a function like this: validateChangEmailTokenAndChangeEmail(token: string): Observable<User> { const callUrl = environment.apiUrl + `users/validate-change-email-token-and-change-email`; return this.http.post<User>(callUrl, token, environment.httpOptions) .pipe(shareReplay(), retry(0)); } My problem is that when I subscribe to this observable (which is subscribed only once when a component […]

By Renis1235
Published
Categorized as angular, angular-httpclient, http Tagged , ,

Duplicate request is always performed when the request throws an error

I have a weird problem. I have a service, which gets data from the Back-end and a function like this: validateChangEmailTokenAndChangeEmail(token: string): Observable<User> { const callUrl = environment.apiUrl + `users/validate-change-email-token-and-change-email`; return this.http.post<User>(callUrl, token, environment.httpOptions) .pipe(shareReplay(), retry(0)); } My problem is that when I subscribe to this observable (which is subscribed only once when a component […]

By Renis1235
Published
Categorized as angular, angular-httpclient, http Tagged , ,

412 error when if/else behaves as intended

I have an Angular snackBar that correctly displays an Error message if certain conditions are met, and a Succcess message if the conditions pass. However, Zone.js in the console is displaying a 412 error ("Precondition failed") only if the Error snackbar pops up. Is the error related to something in my code, or something else? […]

By Bodrov
Published
Categorized as angular, error-handling, http, javascript, zone Tagged , , , ,

Update search results dynamically without retrieving all data with angular

In an app, I try to show him the result of a search by id. Until now, I used to fetch all the data when I launched the application, and then search through them like that : import { Injectable } from ‘@angular/core’; import { Subject } from ‘rxjs’; import { HttpClient } from ‘@angular/common/http’; […]

By Paul Serre
Published
Categorized as angular, fetch, http Tagged , ,

Angular – use API with HTTP Digest Auth

i want to create a web administratin Panel. for this I wrote a backend Controller that helps me delivering required Data… However there are some sensible Data and because of this reason I implemented HTTP Digest auth. If you visit the site in Browser you can simply enter your Username and Password in the Browser […]

By j54j6
Published
Categorized as angular, authentication, http, typescript Tagged , , ,

How to use results from asynchronous function in Angular

I’m trying to use the results from my asynchronous function inside another function, but it keeps saying the result is undefined. This is my structure of my calling function: async callingFn() { let value = await calledFn(); console.log(value); } This is the structure of the function I’m calling: calledFn() { this.myService.getHttpResponse().subscribe( (resp: any) => { […]

Load Angular Bundle from different Server

Is it possible to Load the Angular Bundle Files from a external Source. I have a IoT Device and i am not able to put the Angular files on the IoT Device, also because of Update reasons. The Iot Device does have a small Webserver that can deliver HTML Files. My Idea is to Deliver […]

By Daniel Ehrhardt
Published
Categorized as angular, esp, http Tagged , ,

Controllers.cs works on diffrent address – .net core angular app from visual studio template

I created a new project in .Net Core and Agnular from visual studio template and I cant get data from controller. It works with controller genereted from template WeatherController.cs but not with my own. I mean it works when I call controller like that: https://localhost:5001/home/getData/1 but application starts at 5002 and method from weatherController also […]

By Xia
Published
Categorized as angular, asp.net-core, get, http Tagged , , ,
1 2 3 49

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq