Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

withRequestsMadeViaParent

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

See more...

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.