1,584 questions
1
vote
1
answer
79
views
What are the benefits of map resp in every HttpClient call in Angular
Today, I noticed Copilot is adding .pipe(map(resp => resp)); in every single HttpClient call in Angular.
return this.httpClient.get<ICustomer>('url');
// Rather than - Copilot one
return this....
0
votes
0
answers
66
views
Angular HttpClient - Directly flush to FileSystemWritableFileStream
In my hobby project, i created a SpringBoot & Angular application, where i recently added a "Download Center".
The idea was that a user sometimes needs to download multiple files at once,...
2
votes
1
answer
133
views
Does the httpResource have an HttpContext?
httpResource got released as an experimental feature in Angular 19.2. The httpResource uses the HttpClient under the hood. So I was hoping, I would be able to pass all the options I could pass to the ...
1
vote
1
answer
224
views
Why do I get timeout error while fetching HTTP request inside Angular App?
I am using trying to create a small project based on Angular 20, where I provide front-end for data and charts from Fintacharts API, using SSR (Server-side Rendering), because CORS policies didn't ...
0
votes
1
answer
192
views
Cancel current Angular HttpClient requests [duplicate]
I have an chatbot app built using Angular 18 (Standalone), it allows the users to submit questions where the responses are streamed back using Angular's HTTPClient and then displayed in the UI.
...
1
vote
0
answers
37
views
How to make my API call not give me a string as an error response but the error's body instead? [duplicate]
I have a problem with the management of an error for my API call in my Angular app:
sendRequest(request: BookingRequest): Observable<any>{
const authorityCode = this.tableService.enteId;
const ...
1
vote
1
answer
85
views
Angular displaying Observable Array
I have an API (Node.js) and an Angular frontend.
Now I want to loop through the data and display it. Therefore I perform an HTTP Request to the backend and get back an Observable which i then want to ...
0
votes
1
answer
85
views
How can I test that this public PDF exists in Angular?
In Angular 18, I want to return true or false whether a public PDF exist or not. For example, it should return true for :
https://sigesbre.brgm.fr/files/fiches/MDO_AgenceEau/MDO_AgenceEau_FRGG015.pdf
...
1
vote
1
answer
225
views
What is the best practice for an authGuard (CanActivateFn) with Angular Signals and httpResource for asynchronous authentication status?
I'm using Angular (v20) with Signals and httpResource from @angular/common/http to manage my user's state and authentication. My AuthService exposes a currentUserResource that loads user information ...
1
vote
1
answer
160
views
How to cache query results during re-computation in Angular (19+) Signals?
This is actually a follow-up question of Is there a way to dynamically compute rxResource() or resource() in Angular (19)
We have a list of queries that is computed based on some component state. We ...
1
vote
1
answer
53
views
Functional style interceptors - How to provide them with dependencies
Imagine the situation where you provide any lib to client. Simple scenario, spinner interceptor which needs spinner service.
In old way it was possible to:
providers: [
{
provide: ...
3
votes
2
answers
446
views
Access to the error message of an angular 19 resource
I'm using angular 19. I'm using the new resources to load data like so :
// Skipping imports and decorators for simplicity
export class ApiService {
http = inject(HttpClient);
public myResource = ...
0
votes
1
answer
72
views
How to execute angular http calls in order
I have to make a couple of optional calls to upload files to get ids before I can send a post to a different route with those file ids.
const body = ...
const updateFile1Reference = map((file: File | ...
2
votes
1
answer
1k
views
How do I catch request errors with httpResource in Angular v19?
I'm trying to use the new Angular httpResource. So I created a service:
@Injectable({ providedIn: 'root' })
export class MyService {
resourceConfig = signal<Partial<ResourceConfig>>({})...
2
votes
1
answer
567
views
httpResource and Input-Signal: How does it work? (Angular 19)
I am creating a blog page, that fetches an article. I am using SSR/SSG.
I have problems using input signals and the new httpResource. Neither response1 nor its alternative response2 work.
export class ...
1
vote
3
answers
300
views
How can I bind an id from the URL to an Angular signal and use that signal to fetch product details from an API?
Goal
I'm using Angular with the new signals feature and the experimental HttpResource. I want to:
Extract an id parameter from the route.
Bind this id to a signal.
Use that signal to fetch product ...
1
vote
1
answer
79
views
Angular request duplicate if error is throw
I have a weird behavior with my requests. If the request throw an error, I automatically get a second one launched
Here is an example of my request :
this.http.post(environment['url'] + '/ws/verifier/...
0
votes
1
answer
87
views
Adding delay in HttpTestingController - Angular Unit test
Trying to validate timeout from db queries, not able to achieve it via HttpTestingController.
Not sure how to design the UT. Where to add the timeout in this setup.
it('test timeout', () => {
...
-1
votes
1
answer
394
views
Http Resource is not firing when the signals inside change - Angular 19 (Experimental)
I am learning about httpResource and I can notice that the httpResource signal is not firing when the signal used to generate the URL is changed.
Angular.dev - HttpResource Docs
Below is a simple ...
1
vote
1
answer
75
views
AWS Cognito token endpoint returns 405 Method not Allowed (Angular)
When a user logs in via an SSO they are redirected by to my auth page where I'm grabbing the authorization_code and attempting to authorize the user to grant access.
let headers = new HttpHeaders();
...
2
votes
1
answer
65
views
Angular HTTPClient header returns length of undefined error
Trying to make a simple POST call but getting the error:
TypeError: Cannot read properties of undefined (reading 'length')
at HttpHeaders.applyUpdate (http.mjs:222:27)
at http.mjs:195:58
...
1
vote
1
answer
371
views
Angular httpResource not reloading for signal in interceptor
I have a service with a signal for a selected language:
export class LanguageService {
languages = ['en-US', 'de-DE'];
language = signal('en-US'); //Signal for the selected language
}
I read this ...
1
vote
1
answer
68
views
Does multiple instance of httpClient inside an angular app will use multiple port? (angular) [closed]
Recently i learnt, its best advice to always create single instance of httpClient and reuse it for service lifetime in-order to avoid socket exhaustion, which makes sense, this got me think, in my ...
1
vote
1
answer
198
views
Springboot Backend receives jwt from Angular Fetch request, but not HttpClient { withCredentials: true }
I am developing a Springboot/Angular application. I am running into an annoying issue where my backend is able to receive and parse credentials (in this case, a jwt) from fetch requests but is not ...
1
vote
1
answer
93
views
Angular Query Tanstack Query cleanup logic
I'm using Angular 18 with TanStack Angular Query and have a question about handling observables in the queryFn.
In my queryFn, I'm using lastValueFrom() with an HTTP request like this:
queryFn: () =&...
0
votes
0
answers
73
views
Angular Interceptor repeating every request 3 times
I have an interceptor for refreshing an access token, when it doesn't refresh, everything's all good, but when it does, the unfortunate request that happened to pass through it when it decided to ...
0
votes
1
answer
41
views
Angular interceptor stopping all http requests
I have an interceptor that is supposed to refresh an access token if it's expired and continue the request with the new token, but its just looping a lot (not infinitely, something is stopping it ...
1
vote
1
answer
38
views
http poller using rxjs timer and waitUntil doesn't work
With rxjs 7.5.7, I return a promise when a polling http request will finally returns true after several false values, but takeUntil used is never called again.
I tried to following code:
return timer(...
0
votes
0
answers
23
views
Prevent form from refreshing page when button is clicked in Angular
I'm working on an Angular project and I have a form where I'm trying to prevent the page from refreshing when the "Select" button is clicked. Below is the relevant part of my component and ...
0
votes
1
answer
48
views
How to mimic CURL Post using Angular HttpClient
I have some Angular code using HttpClient, and I simply want to use the "post" method, with a particular payload and headers, with the "toPromise()" option. Yes, I realize ...
1
vote
2
answers
131
views
RxJS complete Observable from within switchmap
I have an HTTP call that does a switchMap to a Promise<boolean>. If that promise returns false, I need it to close the observable. Here is some example code
private method2() : Observable<...
1
vote
1
answer
253
views
Auth Interceptor is not firing [duplicate]
I have an Angular v19 project.
I have the following AuthInterceptor
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
private isRefreshing = false;
constructor(private ...
0
votes
1
answer
205
views
Resolving HTTP Request Pending State During Route Navigation
I currently have the issue that my HTTP requests are stuck in a "pending" state (for more than 10 seconds until it starts the request).
This issue is especially common if I navigate to other ...
0
votes
0
answers
93
views
Getting error: GET https://localhost:5001/api/users net::ERR_CONNECTION_REFUSED | In Angular 18
Client is running at http://localhost:4200/
and server listening on: http://localhost:5245
getting this error after restarting server as well
**Error**: HttpErrorResponse {headers: _HttpHeaders, ...
0
votes
1
answer
154
views
NullInjectorError: R3InjectorError
I'm working in a personal project, using angular, but I receive the following error all the time:
NullInjectorError: R3InjectorError(Environment Injector)[_HttpClient->_HttpClient]: ...
4
votes
1
answer
410
views
How to use provideHttpClient with route-specific interceptors in Angular?
I'm trying to set up provideHttpClient in Angular v19 to use route-specific interceptors, but I'm encountering an issue where no requests are intercepted.
My Setup:
I have a default ApplicationConfig ...
0
votes
0
answers
80
views
Angular HTTP Post date serialization format
I have a JavaScript Date object that is a property of an object that I want to send with an HTTP Post request.
But the problem is that it is serialized using my locale, whereas I need it to be ...
-1
votes
1
answer
56
views
Blocked by CORS policy - openfire Rest API
I am using angular and i am trying to connect with openfire, The connection established successfully, When I try to call get user using httpclient in angular. I got Cors error as below
Access to ...
0
votes
1
answer
251
views
Angular HttpClient: Failled to set any Header in an Http Request
I just started to learn Angular (using Version 19). So far the work with HttpClient goes on quite well. I've tried all kinds of requests with my backend (which is a Spring Boot application), all ...
0
votes
1
answer
56
views
Angular post request body is null when received by Spring API
I am submitting a request from a simple Angular app to test a Spring endpoint I have made. The same JSON is processed successfully when I submit it through Postman, so I suspect that there is ...
-1
votes
1
answer
89
views
HttpClient.get retrieving index.html instead of an asset file
When I run the code below locally it works fine.
When it is pushed to server (AWS Amplify) it fails to work correctly.
In the console there is an error:
ERROR Error: Invalid HTML: could not find <...
5
votes
2
answers
6k
views
Angular 19 Standalone Component Error: "No provider for _HttpClient" Despite HttpClientModule Imported
I am working on an Angular standalone application and encountering the following error when using HttpClient in my DataService:
ERROR Error [NullInjectorError]: R3InjectorError(Standalone[...
1
vote
1
answer
155
views
Angular 18 read JSON file in assets folder
In angular 18, I have to read a json file using HTTP client. I cannot predict the hosted URL. The site may be hosted in two or three level sub folder domain names. How can I read the json files from ...
2
votes
1
answer
161
views
Troubleshooting NG0203 Error: Issues with Angular Library and HttpClient Injection in Production Build
I wasn't able to solve it. I'm counting on your help.
I have an Angular application and a library.
In the library, I have a service where I inject HttpClient. I set HttpClient as a provider in the ...
1
vote
3
answers
125
views
How to use 'httpClient' for a link (not an API call)
I have an Angular app that uses HttpClient for API calls. These return Observables of data types that I can use for various purposes, i.e. an Observable<Widget[]> can be used to display a list ...
1
vote
1
answer
45
views
Postman POST call works Angular doesn't [duplicate]
I have the following problem:
I am trying to make a mew record in a mongoDB database using a call from an Angular frontend. For some reason when i initiate the POST request i dont get any kind of ...
1
vote
2
answers
175
views
HTTP GET throws TypeError: Cannot read properties of undefined (reading 'length')
I want to use a simple method to check for internet connectivity. We have a file hosted on a server and I simply want to check that we can see it.
The file contains:
{
"status": "...
2
votes
1
answer
111
views
HttpContextToken always false while using HttpInterceptorFn
I am implementing a loading spinner that runs for all my http requests via an HttpInterceptorFn using this blog post as a guide: https://blog.angular-university.io/angular-loading-indicator/
loading....
1
vote
1
answer
53
views
One-to-one relationship in Spring Boot: Attribute is not saved from Angular frontend, but works in Postman
Why is the race object not being saved in the database when using my Angular app, but it works correctly via Postman?
´Hallo, I'm developing an application with Spring Boot and Angular. I have a Puppy ...
0
votes
0
answers
31
views
Any way to use Angular's HttpClientTestingModule on code with awaits?
I'm trying to add unit tests to legacy code and noticed that if the code uses "await" I need to call a tick or flushMicrotask between each httpTestingController's expect. Here is the ...