MCPcopy Create free account
hub / github.com/angular/components / externalRedirect

Function externalRedirect

docs/src/app/routes.ts:99–112  ·  view source on GitHub ↗
(target: string | (() => string))

Source from the content-addressed store, hash-verified

97}
98
99function externalRedirect(target: string | (() => string)): Partial<Route> {
100 // Typed explicitly, because `canActivate` also accepts deprecated class-based guards. Any function
101 // matches that type as well, so an inline guard wouldn't have its return value type checked.
102 const redirect: CanActivateFn = () => {
103 window.location.href = typeof target === 'string' ? target : target();
104 return false;
105 };
106
107 return {
108 // The router requires a `component`.
109 component: RedirectPlaceholder,
110 canActivate: [redirect],
111 };
112}

Callers 1

adevRedirectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected