MCPcopy
hub / github.com/angular/angular / checkRedirect

Function checkRedirect

packages/router/test/apply_redirects.spec.ts:1886–1912  ·  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

1884});
1885
1886async function checkRedirect(
1887 config: Routes,
1888 url: string,
1889 callback: (t: UrlTree, state: RouterStateSnapshot) => void,
1890 paramsInheritanceStrategy: ParamsInheritanceStrategy = 'always',
1891 errorCallback?: (e: unknown) => void,
1892): Promise<void> {
1893 try {
1894 const {tree, state} = await recognize(
1895 TestBed.inject(EnvironmentInjector),
1896 TestBed.inject(RouterConfigLoader),
1897 null,
1898 config,
1899 createUrlTree(url),
1900 new DefaultUrlSerializer(),
1901 paramsInheritanceStrategy,
1902 new AbortController().signal,
1903 );
1904 callback(tree, state);
1905 } catch (e) {
1906 if (errorCallback) {
1907 errorCallback(e);
1908 } else {
1909 throw e;
1910 }
1911 }
1912}
1913
1914function createUrlTree(url: string): UrlTree {
1915 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…