MCPcopy Create free account
hub / github.com/angular/angular / triggerRedirectIfCommand

Function triggerRedirectIfCommand

packages/router/src/router_error_boundary.ts:40–47  ·  view source on GitHub ↗

* Dispatches a navigation if the given error is (or wraps) a `RedirectCommand`. * * @returns Whether the error was a redirect.

(error: unknown, router: Router)

Source from the content-addressed store, hash-verified

38 * @returns Whether the error was a redirect.
39 */
40function triggerRedirectIfCommand(error: unknown, router: Router): boolean {
41 const redirect = unwrapRedirectCommand(error);
42 if (redirect === null) {
43 return false;
44 }
45 router.navigateByUrl(redirect.redirectTo, redirect.navigationBehaviorOptions);
46 return true;
47}
48
49/**
50 * Implementation of the router error boundary behavior. This is only included in the bundle when

Callers 1

handleErrorMethod · 0.85

Calls 2

unwrapRedirectCommandFunction · 0.85
navigateByUrlMethod · 0.45

Tested by

no test coverage detected