Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

provideHttpClient

Configures Angular's HttpClient service to be available for injection.

See more...

See also

Description

By default, HttpClient will be configured for injection with its default options for XSRF protection of outgoing requests. Additional configuration options can be provided by passing feature functions to provideHttpClient. For example, HTTP interceptors can be added using the withInterceptors(...) feature.

It's strongly recommended to enable fetch for applications that use Server-Side Rendering for better performance and compatibility. To enable fetch, add withFetch() feature to the provideHttpClient() call at the root of the application:

      
      provideHttpClient(withFetch());