Skip to content

feat(router): introduce route error boundaries and redirect handling - #71117

Draft
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:router-boundary
Draft

JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:router-boundary

Conversation

@JeanMeche

Copy link
Copy Markdown
Member

Introduces error boundary support in the Angular Router, allowing individual routes to declare an errorComponent and applications to configure global fallback defaults via withErrorBoundaries.

Key Features:

  • Route Error Components: Define errorComponent on Route to render a fallback component when routed components or non-blocking resources fail.
  • Input & Route Data Binding: Expose caught error via readonly error = input<Error>() on error components with precedence over colliding route parameters, query parameters, or resolvers. Bind path parameters and static data to error components via withComponentInputBinding().
  • Deterministic RedirectCommand Handling: Automatically unwrap and dispatch RedirectCommand thrown within routed components or resource loaders, with deduplication across nested boundaries.
  • Global Error Boundaries: Provide withErrorBoundaries({ defaultErrorComponent, onError }) for global defaults and monitoring hooks (invoked in the root injection context) without polluting Router.events.
  • Fail-Safe Fallbacks: Bubble uncaught exceptions inside error components to parent template boundaries or global ErrorHandler.
  • Documentation: Add comprehensive guide and reference updates in adev and in-repo design docs.

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: router labels Oct 1, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 1, 2026
@JeanMeche JeanMeche added target: minor This PR is targeted for the next minor release and removed detected: feature PR contains a feature commit labels Oct 1, 2026
@angular-robot angular-robot Bot added the detected: feature PR contains a feature commit label Oct 1, 2026
@JeanMeche
JeanMeche force-pushed the router-boundary branch 2 times, most recently from 1edccd9 to 6a53731 Compare October 1, 2026 13:50
Introduces error boundary support in the Angular Router, allowing individual routes to declare an `errorComponent` and applications to configure global fallback defaults via `withErrorBoundaries`.

Key Features:
- Route Error Components: Define `errorComponent` on `Route` to render a fallback component when routed components or non-blocking resources fail.
- Input & Route Data Binding: Expose caught error via `readonly error = input<Error>()` on error components with precedence over colliding route parameters, query parameters, or resolvers. Bind path parameters and static data to error components via `withComponentInputBinding()`.
- Deterministic RedirectCommand Handling: Automatically unwrap and dispatch `RedirectCommand` thrown within routed components or resource loaders, with deduplication across nested boundaries.
- Global Error Boundaries: Provide `withErrorBoundaries({ defaultErrorComponent, onError })` for global defaults and monitoring hooks (invoked in the root injection context) without polluting `Router.events`.
- Fail-Safe Fallbacks: Bubble uncaught exceptions inside error components to parent template boundaries or global ErrorHandler.
- Documentation: Add comprehensive guide and reference updates in adev and in-repo design docs.
return this.activated;
}
private _activatedRoute: ActivatedRoute | null = null;
// TODO: Consider whether the error boundary feature should offer a way to recover from an error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll keep it as a todo for now.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Deployed adev-preview for ad8ec6a to: https://ng-dev-previews-fw--pr-angular-angular-71117-adev-prev-3xmiom00.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adev: preview area: router detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants