provideHttpClient
Configures Angular's HttpClient
service to be available for injection.
provideHttpClient(...features: HttpFeature<HttpFeatureKind>[]): EnvironmentProviders
Parameters
features
|
HttpFeature<HttpFeatureKind>[] |
Returns
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());