• Overview
@angular/router

withErrorBoundaries

function

Enables error boundary support in the Router.

API

Description

Enables error boundary support in the Router.

When enabled, errors thrown within routed components (lifecycle hooks, template bindings, resource loaders, and event handlers) are caught by the RouterOutlet. If the route or feature defines an errorComponent, it is rendered in place of the failed component, receiving the caught error through an error input.

Usage Notes

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter(
      appRoutes,
      withErrorBoundaries({
        defaultErrorComponent: GlobalErrorComponent,
      }),
    ),
  ],
});
Jump to details