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

Function adevRedirect

docs/src/app/routes.ts:85–97  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

83];
84
85function adevRedirect(path: string) {
86 return externalRedirect(() => {
87 const match = window.location.hostname.match(/^([a-zA-Z0-9]+)\.material\.angular\./);
88 let version: string | null = null;
89
90 if (match) {
91 // adev doesn't have an RC URL so we route to next.
92 version = match[1].toLowerCase() === 'rc' ? 'next' : match[1];
93 }
94
95 return `https://${version ? version + '.' : ''}angular.dev${path}`;
96 });
97}
98
99function externalRedirect(target: string | (() => string)): Partial<Route> {
100 // Typed explicitly, because `canActivate` also accepts deprecated class-based guards. Any function

Callers 1

routes.tsFile · 0.85

Calls 1

externalRedirectFunction · 0.85

Tested by

no test coverage detected