provideHttpClient
Configures Angular's HttpClient
service to be available for injection.
provideHttpClient
Configures Angular's HttpClient
service to be available for injection.
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:
EnvironmentProviders
Description
Configures Angular's HttpClient
service to be available for injection.
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: