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

Function checkRedirect

packages/router/test/apply_redirects.spec.ts:1969–1995  ·  view source on GitHub ↗
(
  config: Routes,
  url: string,
  callback: (t: UrlTree, state: RouterStateSnapshot) => void,
  paramsInheritanceStrategy: ParamsInheritanceStrategy = 'always',
  errorCallback?: (e: unknown) => void,
)

Source from the content-addressed store, hash-verified

1967});
1968
1969async function checkRedirect(
1970 config: Routes,
1971 url: string,
1972 callback: (t: UrlTree, state: RouterStateSnapshot) => void,
1973 paramsInheritanceStrategy: ParamsInheritanceStrategy = 'always',
1974 errorCallback?: (e: unknown) => void,
1975): Promise<void> {
1976 try {
1977 const {tree, state} = await recognize(
1978 TestBed.inject(EnvironmentInjector),
1979 TestBed.inject(RouterConfigLoader),
1980 null,
1981 config,
1982 createUrlTree(url),
1983 new DefaultUrlSerializer(),
1984 paramsInheritanceStrategy,
1985 new AbortController().signal,
1986 );
1987 callback(tree, state);
1988 } catch (e) {
1989 if (errorCallback) {
1990 errorCallback(e);
1991 } else {
1992 throw e;
1993 }
1994 }
1995}
1996
1997function createUrlTree(url: string): UrlTree {
1998 return new DefaultUrlSerializer().parse(url);

Callers 1

Calls 4

recognizeFunction · 0.90
createUrlTreeFunction · 0.85
injectMethod · 0.65
callbackFunction · 0.50

Tested by

no test coverage detected