W3cubDocs

/Angular

withRequestsMadeViaParent

function developer preview

Configures the current HttpClient instance to make requests via the parent injector's HttpClient instead of directly.

See more...

withRequestsMadeViaParent(): HttpFeature<HttpFeatureKind.RequestsMadeViaParent>

Parameters

There are no parameters.

Returns

HttpFeature<HttpFeatureKind.RequestsMadeViaParent>

See also

Description

By default, provideHttpClient configures HttpClient in its injector to be an independent instance. For example, even if HttpClient is configured in the parent injector with one or more interceptors, they will not intercept requests made via this instance.

With this option enabled, once the request has passed through the current injector's interceptors, it will be delegated to the parent injector's HttpClient chain instead of dispatched directly, and interceptors in the parent configuration will be applied to the request.

If there are several HttpClient instances in the injector hierarchy, it's possible for withRequestsMadeViaParent to be used at multiple levels, which will cause the request to "bubble up" until either reaching the root level or an HttpClient which was not configured with this option.

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/http/withRequestsMadeViaParent