1,584 questions
2
votes
2
answers
5k
views
HTTP Interceptor is not working in Angular 17 project
My AuthInterceptor.intercept method is not getting called. Putting all necessary codes below. My code flow: FormSubmit() method from login.component calls the generateToken() method from login.service(...
-1
votes
1
answer
126
views
HttpInterceptor with member-variables
I made an interceptor-service for adding a auth-header to every HTTP-request.
Service
@Injectable ()
export class HttpInterceptorService implements HttpInterceptor
{
token : string = undefined;
...
0
votes
1
answer
203
views
Compiling Angular app: Error: export 'ɵwithHttpTransferCache' (imported as 'ɵwithHttpTransferCache') was not found in '@angular/common/http'
I've recently updated my app to Angular 17 and I'm getting this weird error at compile time:
./node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs:2016:81-103
Error: export '...
1
vote
2
answers
3k
views
NullInjectorError: No provider for _HttpClient
Hey everyone so I am new to Angular i am stuck at this error :
ERROR NullInjectorError: R3InjectorError(Standalone[_AppComponent])[_ApiCallServiceService -> _ApiCallServiceService -> _HttpClient ...
1
vote
1
answer
1k
views
Set timeout for HTTP POST request returning JSON
I am running HTTP requests against an API which occasionally is super slow, meaning I need to extend its timeout value. The API returns a simple JSON array of Dimension objects. This my POST request ...
35
votes
10
answers
68k
views
No provider for _HttpClient
I'm working on a personal project with Angular 17, and there are some settings that I get from the backend of my application. But my Angular HttpClient does not work and honestly I don't know why not.
...
0
votes
1
answer
664
views
Angular HttpClient does not send request
I am in the process of developing an Angular frontend application for my .NET 7 backend WebApi, and I have encountered a strange issue that I cannot find the proper solution or root-cause for. The ...
0
votes
1
answer
2k
views
How to intercept Websockets, Server Sent Events (SSE) and ReadableStream Request and Response in Angular?
I want stream real time data from server to client. We are using Angular 16. I want to intercept the Request and Response of WebSockets, Server Sent Events (SSE) and ReadableStream using Angular ...
0
votes
0
answers
137
views
Angular interceptor for switching requests
I want to create an interceptor (or any other solution that will affect all the services), that will hold the POST requests for ~300ms and in case there are new POST requests in that time gap, will ...
1
vote
1
answer
2k
views
Angular 17 Hydration - POST requests triggered both client/server side while GET requests are only server side?
I'm testing the brand new release of Angular 17 with Universal SSR and non-destructive hydration and I've noticed a peculiar behavior.
In my test component, I have both GET and POST requests being ...
0
votes
0
answers
238
views
Angular HTTP call with cert
I have a Post API call which is working fine in Postman with certificate(CRT and Key file).
While calling this api from frontend, I am getting 'HttpErrorResponse' error on browser.
Do i need to ...
1
vote
1
answer
194
views
No provider for HttpClient even HttpClientModule is already added to app.module.ts
I am currently studying Angular and ASP.NET Core Web API but I can't resolve the error regarding HttpClient.
Main error message:
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(...
-1
votes
1
answer
81
views
How to read and write JSON with Angular
I want to read a json, save it in an array and after doing changes to said array, replace the information in the json with the new information in the array.
I have this model
export class User{
id : ...
0
votes
0
answers
42
views
Transmit object with getter/setter property via HttpClient
I have the following class:
export class FileData {
get name(): string { return this.#name || (this.data ? `Unnamed.${this.data.match(/[^:/]\w+(?=;|,|\+)/)?.[0]}` : '') }
set name(name: string) { ...
-1
votes
1
answer
1k
views
Angular 16 HttpClient get response from service
I'm trying to do a http client get from my Angular 16 solution. I have created an app\models folder that contains the request and response models that I intend to use with the angular client. I would ...
10
votes
1
answer
24k
views
Angular standalone app: NullInjectorError: No provider for HttpClient
I'm creating a standalone app from scratch, I don't have an ngModule.
I'm creating a translation service, and a pipe to use it.
testing it on app.component.ts
import { Component, OnInit } from '@...
0
votes
2
answers
922
views
Angular HttpClient - request not executed
I cant get the HttpClient request to be fired. Probably it is some importing or providing issue, but can't find where it is.
The API does work, but never gets called.
As for the environment/versions:
...
0
votes
1
answer
337
views
Angular Universal TransferHttpCacheModule is not working inside a route on router navigation, only after reload
I have an Universal app with TransferHttpCacheModule addet to app.module.ts like that:
@NgModule({
...
imports: [
BrowserModule,
TransferHttpCacheModule,
AppRoutingModule,
],
...
0
votes
1
answer
70
views
Sending a GET command every 10 seconds does not request the backend
In my service:
public sendUpdate(idBombeamento:number): Observable<any>{
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': `...
-1
votes
1
answer
82
views
How to store httpClient.get data and use it after read
I have been trying to read a text file and store the data and use it later but once the scope of variable is over the variable gets cleared. I have been trying to utilize the data throughout the ...
0
votes
0
answers
70
views
users' with id='admin' not found angular
I'm facing an issue with an Angular HTTP request that's failing when trying to retrieve data from a specific API endpoint. The request works fine in Postman and functions as expected when using ...
0
votes
1
answer
312
views
Resolve CORS error in Angular for 3rd party API
I have a simple API call to make within Angular using the http client:
return this.http.get('https://api.someexternalapi.com').pipe(
map((response) => response),
catchError(error => of(...
2
votes
1
answer
1k
views
Angular - Handle HTTP response with DTO
I can't seem to find a complete example of how to handle a complex Angular HTTP response.
I am using Angular 16.
The backend API I am trying to communicate with supplies a DTO (Data Transfer Object) ...
1
vote
2
answers
414
views
Angular HttpClient calls api twice when an HttpInterceptor is set
I have set a HttpInterceptor for setting an api key in the request headers:
export const authInterceptor: HttpInterceptorFn = (req, next) => {
console.log('authInterceptor');
console.log('...
0
votes
2
answers
587
views
Angular HTTP - Not updating the HTTP request headers
// inject the httpclient
protected _http: HttpClient = inject(HttpClient);
// this is how I create the options
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/tcc'
...
1
vote
1
answer
1k
views
Issue with CapacitorHttp on iOS
I recently switched HTTP calls from the Cordova plugin to CapacitorHttp, and having sporadic issues with IOS (only).
Using the latest Ionic 7.2.2 and Capacitor 5.2.2. Running against a back-end web ...
1
vote
1
answer
2k
views
Angular HttpClient analogue for fetch keepalive flag
I am developing an Angular application using its HttpClient. I found that fetch() Api does support the useful keepalive option to maintain the connection beyond the livetime of the html page.
fetch(...
0
votes
1
answer
156
views
fastAPI credentials are missing for POST requests
server middleware config:
@app.middleware("http")
async def inspector(request: Request, call_next):
print(f"{request.method} {request.url}")
response = await call_next(...
2
votes
0
answers
225
views
How to use the function "getStreamUserToken" from Firebase Authenticate with Stream Chat extension in client-side Angular?
I am trying to use the getStreamUserToken function from Firebase Authenticate with Stream Chat extension in an Angular client-side application. However, my implementation is not working as expected. ...
0
votes
1
answer
47
views
Parse Angular Http Reponse And Handle Json
I have a code that calls http post and recieves the observable notification when data is recieved .
I wish to know how to get the json respose from the server in the following function since when I ...
0
votes
1
answer
388
views
How to access cookies in angular UI set by backend running on different port
Please find my below use case:
There is a backend web service developed in Java running at http://localhost:8080 and an angular UI application running at http://localhost:4200. Now my requirement is ...
0
votes
1
answer
1k
views
try to fetch data from api in angular but get error that Cannot find a differ supporting object '[object Object]' of type 'object'
My Angular version is 16.0.1 and I try fetch data from Api
https://dummy.restapiexample.com/api/v1/employees
this is my Model
export interface Emploee {
employee_name: string;
}
My service is
import {...
-1
votes
1
answer
43
views
Function that can call two APIs, one of them returns an array
I have the following code:
getElements(apiUrl: string): Observable<Element[]> {
return this.httpClient.get<any>(apiUrl + 'test/elements').pipe(
catchError(error => {
...
0
votes
1
answer
841
views
Can't make http request with Angular 15
For some reason I can't get my Angular 15 app to send an http request. I'm used to an older version of Angular so I wonder if it's some configuration I'm missing or something. I also already added ...
2
votes
0
answers
406
views
Angular REST request fails with CORS Missing Allow Origin
I'm calling my backend (multiple microservices) inside my Angluar SPA and I'm getting this error:
As you see, there is a response (so the request aimed to the right path ect.) but the browser seems ...
0
votes
1
answer
70
views
Map enumeration JSON value to readonly static field
I have the following typescript type:
export class Status {
static readonly DONE = new Status('DONE', 'p-tag-green');
static readonly PENDING = new Status('PENDING', 'p-tag-yellow');
private ...
1
vote
1
answer
11k
views
In angular library - Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initialize
After updating one of my project from angular 9 to 15 I'm getting below issue. any help would be appreciated. I'm stuck in it for more then 2 weeks.
app-lib.module.ts in the angular library.
import { ...
0
votes
1
answer
302
views
Why I get only two headers in Angular using HttpClient?
I'm trying to get all headers from the response to a post method:
this.http.post<User>(this.url, user, {
observe: 'response',
responseType: 'json',
})
.subscribe((res)...
-1
votes
1
answer
45
views
Why can I not set private allTodos property in service with data coming from http request?
I have a todo-list component and I'd like to populate that component with a todo-service. This service is grabbing the data from a local JSON file.
My todo-list component looks like this:
import 'zone....
0
votes
1
answer
610
views
*ngFor won't Iterate through array data
So I am having trouble Iterating through an array. Angular does not show all the data. It only shows the data at the specific location.
This is the Component
export class LiveComponent implements ...
-1
votes
1
answer
88
views
How can I Interpolate data from HttpClient Rest Api?
I have this component where I am pulling data from a REST API using the HttpClient. The pulling of the data works well. I could tell because I could see the data being displayed in Console Log.
When ...
0
votes
1
answer
228
views
Angular 15 - "Unkown error" on HttpRequest to server I developed [duplicate]
I am developing a website with Angular 15 and I get the data from two APIs. One is public (The Movie Database) and I had no problem working with it.
I developed the other one and is deployed on my ...
2
votes
1
answer
6k
views
Angular HttpClient with Promise (firstValueFrom) error handled twice
I use interceptor like this
export class ServerErrorInterceptor implements HttpInterceptor {
constructor(
private appMessageService: AppMessageService) { }
intercept(request: ...
1
vote
2
answers
110
views
No data is being displayed in table
I have created a simple test project to learn some Angular basics such as CRUD functions, ngFor, and HttpClient methods (get, post).
Now I have created a Firebase database with an API key and added ...
0
votes
1
answer
816
views
Angular HttpClient - Unable to post values to ASP.NET CORE Web API
I've created a component "form-page" in the "form" module:
form-page.component.html:
<form [formGroup]="form" (submit)="onSubmit()">
<div>
...
-1
votes
1
answer
2k
views
What dictates Angular's HTTPClient.get timeout?
I have some frontend code, which sends out an HTTPClient.get request to a Lambda function I have.
It's working fine. But I started thinking about how to explore the limits of HTTPClient and fell short ...
0
votes
1
answer
488
views
Querying data with parameters using httpClient with Angular13
I'm using Angular 13 and I can pull data with httpClient. But I want to pull data by sending parameter.
How can I do this by sending parameters like below?
inventory.ts
this.inventoryService....
0
votes
1
answer
458
views
.NET core controller not receiving correct input from query string
I have an Angular client making requests to a .NET core API. There are two functions that are nearly identical, one works, and the other does not. I can not figure out what the difference is.
Here are ...
2
votes
1
answer
691
views
Cannot send post requests in Angular with HttpClient
I'm trying to send a post request to a json file in typescript, Angular with HttpClient. However, I get a 404 not found error, saying it cannot fine the file results.json. I find this weird because ...
2
votes
1
answer
631
views
Can't get data from mysql database
I'm trying to get some data from a mysql database.
The backend seems to work fine, the data is being logged there but not in the frontend.
app.post('/api/user/database_test', (req, res, next) => {
...