diff --git a/modules/@angular/router/src/apply_redirects.ts b/modules/@angular/router/src/apply_redirects.ts index a517a898d6..3cf14bd031 100644 --- a/modules/@angular/router/src/apply_redirects.ts +++ b/modules/@angular/router/src/apply_redirects.ts @@ -18,7 +18,7 @@ import {merge} from './utils/collection'; class NoMatch { constructor(public segment: UrlSegment = null) {} } -class GlobalRedirect { +class AbsoluteRedirect { constructor(public paths: UrlPathWithParams[]) {} } @@ -26,7 +26,7 @@ export function applyRedirects(urlTree: UrlTree, config: RouterConfig): Observab try { return createUrlTree(urlTree, expandSegment(config, urlTree.root, PRIMARY_OUTLET)); } catch (e) { - if (e instanceof GlobalRedirect) { + if (e instanceof AbsoluteRedirect) { return createUrlTree( urlTree, new UrlSegment([], {[PRIMARY_OUTLET]: new UrlSegment(e.paths, {})})); } else if (e instanceof NoMatch) { @@ -98,7 +98,7 @@ function expandPathsWithParamsAgainstRouteUsingRedirect( function expandWildCardWithParamsAgainstRouteUsingRedirect(route: Route): UrlSegment { const newPaths = applyRedirectCommands([], route.redirectTo, {}); if (route.redirectTo.startsWith('/')) { - throw new GlobalRedirect(newPaths); + throw new AbsoluteRedirect(newPaths); } else { return new UrlSegment(newPaths, {}); } @@ -111,7 +111,7 @@ function expandRegularPathWithParamsAgainstRouteUsingRedirect( const newPaths = applyRedirectCommands(consumedPaths, route.redirectTo, positionalParamSegments); if (route.redirectTo.startsWith('/')) { - throw new GlobalRedirect(newPaths); + throw new AbsoluteRedirect(newPaths); } else { return expandPathsWithParams( segment, routes, newPaths.concat(paths.slice(lastChild)), outlet, false); diff --git a/modules/@angular/router/src/config.ts b/modules/@angular/router/src/config.ts index 560f6b7712..89775f55fb 100644 --- a/modules/@angular/router/src/config.ts +++ b/modules/@angular/router/src/config.ts @@ -94,7 +94,7 @@ import {Type} from '@angular/core'; * '/team/11/user/jim', and then will instantiate the team component with the user component * in it. * - * If the `redirectTo` value starts with a '/', then it is a global redirect. E.g., if in the + * If the `redirectTo` value starts with a '/', then it is an absolute redirect. E.g., if in the * example above we change the `redirectTo` to `/user/:name`, the result url will be '/user/jim'. * * ### Empty Path diff --git a/modules/@angular/router/test/apply_redirects.spec.ts b/modules/@angular/router/test/apply_redirects.spec.ts index 129cb529b7..d7c73c5467 100644 --- a/modules/@angular/router/test/apply_redirects.spec.ts +++ b/modules/@angular/router/test/apply_redirects.spec.ts @@ -115,17 +115,17 @@ describe('applyRedirects', () => { '/a/1(aux:c/d)', (t: UrlTree) => { compareTrees(t, tree('/404')); }); }); - it('should support global redirects', () => { + it('should support absolute redirects', () => { checkRedirect( [ { path: 'a', component: ComponentA, - children: [{path: 'b/:id', redirectTo: '/global/:id'}] + children: [{path: 'b/:id', redirectTo: '/absolute/:id'}] }, {path: '**', component: ComponentC} ], - '/a/b/1', (t: UrlTree) => { compareTrees(t, tree('/global/1')); }); + '/a/b/1', (t: UrlTree) => { compareTrees(t, tree('/absolute/1')); }); }); describe('empty paths', () => { @@ -144,7 +144,7 @@ describe('applyRedirects', () => { 'b', (t: UrlTree) => { compareTrees(t, tree('a/b')); }); }); - it('redirect from an empty path should work (global redirect)', () => { + it('redirect from an empty path should work (absolute redirect)', () => { checkRedirect( [ {