Skip to content

Commit 2f9f89b

Browse files
committed
docs: Update README.md with information about HttpClient module deprecation in Angular v17
1 parent 7b2df19 commit 2f9f89b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,38 @@ export class AppRoutingModule {}
38423842

38433843
[Back to top⤴️](#table-of-contents)
38443844

3845+
## HTTP Client Module
3846+
3847+
The `HttpClientModule` is used to make HTTP requests to a server in an Angular application. It provides services for making GET, POST, PUT, DELETE, and other types of requests.
3848+
3849+
```ts
3850+
import { HttpClientModule } from '@angular/common/http';
3851+
3852+
@NgModule({
3853+
imports: [HttpClientModule],
3854+
})
3855+
3856+
export class AppModule {}
3857+
```
3858+
3859+
In the angular v17 and above, the `HttpClientModule` has been deprecated. Instead, you can use the `provideHttpClient` function to provide the `HttpClient` service in your application. Here is an example of how to use the `provideHttpClient` function to provide the `HttpClient` service in your application:
3860+
3861+
```ts
3862+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
3863+
import { provideRouter } from '@angular/router';
3864+
3865+
import { routes } from './app.routes';
3866+
import { provideHttpClient } from '@angular/common/http';
3867+
3868+
export const appConfig: ApplicationConfig = {
3869+
providers: [
3870+
provideZoneChangeDetection({ eventCoalescing: true }),
3871+
provideRouter(routes),
3872+
provideHttpClient(),
3873+
],
3874+
};
3875+
```
3876+
38453877
## HTTP Client
38463878

38473879
The `HttpClient` service is used to make HTTP requests to a server. It provides methods for making GET, POST, PUT, DELETE, and other types of requests.

0 commit comments

Comments
 (0)