Skip to main content
cngx-src documentation

provideAsyncHttpObservability

Functioncommon/data/async-registry

projects/common/data/async-registry/http-interceptor.ts

Description#

Sets up HttpClient with cngxAsyncInterceptor so every request surfaces in CngxAsyncRegistry. Opt-in - add it to bootstrapApplication providers alongside provideAsyncRegistry().

bootstrapApplication(AppComponent, {
  providers: [
    provideAsyncRegistry(),
    provideAsyncHttpObservability(),
  ],
});

Use this only when cngx owns the HttpClient setup. It calls provideHttpClient(withInterceptors([cngxAsyncInterceptor])) internally, so an app that already calls provideHttpClient (especially with withFetch() or other features) would get a second, feature-less HttpClient configuration - last-provider-wins on HttpBackend can silently revert withFetch() to the XHR backend. In that case do not call this; add the exported cngxAsyncInterceptor to your own withInterceptors instead:

provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))

Signature#

provideAsyncHttpObservability()

Returns#

EnvironmentProviders