Skip to content

Commit

Permalink
docs: Update README.md with information about HttpClient module depre…
Browse files Browse the repository at this point in the history
…cation in Angular v17
  • Loading branch information
manthanank committed Oct 9, 2024
1 parent 7b2df19 commit 2f9f89b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3842,6 +3842,38 @@ export class AppRoutingModule {}

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

## HTTP Client Module

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.

```ts
import { HttpClientModule } from '@angular/common/http';

@NgModule({
imports: [HttpClientModule],
})

export class AppModule {}
```

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:

```ts
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideHttpClient(),
],
};
```

## HTTP Client

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.
Expand Down

0 comments on commit 2f9f89b

Please sign in to comment.