1,584 questions
1
vote
1
answer
78
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....
2
votes
1
answer
131
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 ...
0
votes
1
answer
179
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
1
answer
81
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 ...
1
vote
1
answer
211
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
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: ...
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
549
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
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/...
-1
votes
1
answer
390
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 ...
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
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
84
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
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 ...
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 ...
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<...
0
votes
1
answer
192
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
1
answer
151
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]: ...
0
votes
0
answers
78
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 ...
0
votes
1
answer
242
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 ...
-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 <...
1
vote
1
answer
149
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 ...
1
vote
3
answers
124
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
2
answers
172
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": "...
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 ...