Angular detected that HttpClient is not configured to use fetch APIs. It's strongly

 NG02801: Angular detected that HttpClient is not configured to use fetch APIs. It's strongly recommended to enable fetch for applications that use Server-Side Rendering for better performance and compatibility. To enable fetch, add the withFetch() to the provideHttpClient() call at the root of the applicati



Solution:

import { NgModule } from '@angular/core';

import { BrowserModule } from '@angular/platform-browser';

import { HttpClientModule, provideHttpClient, withFetch } from '@angular/common/http';

import { AppComponent } from './app.component';


@NgModule({

  declarations: [AppComponent],

  imports: [BrowserModule, HttpClientModule],

  providers: [

    // Configure HttpClient to use fetch

    provideHttpClient(withFetch()),

  ],

  bootstrap: [AppComponent],

})

export class AppModule {}


No comments:

Post a Comment

C# .Net Fundamentals interview questions

  1. Basic .NET Concepts What is the  .NET Framework ? A software framework by Microsoft that provides a runtime (CLR) and libraries for bui...

Best for you