provideHttpClient
function
Configures Angular's HttpClient
service to be available for injection.
API
Description
function provideHttpClient( ...features: HttpFeature<HttpFeatureKind>[]): EnvironmentProviders;
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:
@returns
EnvironmentProviders
Jump to details