[ Web Proxy ]
URL:
Viewing: https://angular.dev/api/common/http/provideHttpClient [Back]  [Original]

provideHttpClient Angular Skip to main content
menu
close
more_horiz
menuAPI
@angular/common/http

provideHttpClient

function

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

HTTP ClientwithInterceptorswithInterceptorsFromDiwithXsrfConfigurationwithNoXsrfProtectionwithJsonpSupportwithRequestsMadeViaParentwithXhr

On this page

    arrow_upward_alt Back to the top

    API

    Description

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

    The HttpClient service is provided in the root by default.

    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.

    By default, HttpClient uses the fetch API to make requests. This is strongly recommended for applications that use Server-Side Rendering for better performance and compatibility. To use the XMLHttpRequest API instead, add the withXhr feature:

    Jump to details

    Web Proxy Viewer  |  New URL  |  Original Page