From ecfc36de022e4c3dcc6c36454992d0701687cd12 Mon Sep 17 00:00:00 2001 From: Foxandxss Date: Fri, 1 Jul 2016 00:11:33 +0200 Subject: [PATCH] docs: replace terminal with pathMatch --- .../router/ts/app/crisis-center/crisis-center.routes.2.ts | 2 +- .../router/ts/app/crisis-center/crisis-center.routes.3.ts | 2 +- .../router/ts/app/crisis-center/crisis-center.routes.4.ts | 2 +- .../router/ts/app/crisis-center/crisis-center.routes.ts | 2 +- public/docs/_examples/toh-5/ts/app/app.routes.1.ts | 2 +- public/docs/_examples/toh-5/ts/app/app.routes.ts | 2 +- public/docs/_examples/toh-6/ts/app/app.routes.ts | 2 +- public/docs/ts/latest/guide/router.jade | 7 +++++-- 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.2.ts b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.2.ts index 43eadbd55e..5f44ba160a 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.2.ts +++ b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.2.ts @@ -10,7 +10,7 @@ export const CrisisCenterRoutes: RouterConfig = [ { path: '', redirectTo: '/crisis-center', - terminal: true + pathMatch: 'full' }, // #enddocregion redirect { diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.3.ts b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.3.ts index 1f194ac6f7..75af21c534 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.3.ts +++ b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.3.ts @@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [ { path: '', redirectTo: '/crisis-center', - terminal: true + pathMatch: 'full' }, { path: 'crisis-center', diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.4.ts b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.4.ts index f238e132a7..b49bf6dfda 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.4.ts +++ b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.4.ts @@ -13,7 +13,7 @@ export const CrisisCenterRoutes: RouterConfig = [ { path: '', redirectTo: '/crisis-center', - terminal: true + pathMatch: 'full' }, { path: 'crisis-center', diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.ts b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.ts index a924aa5771..6f40ce64b3 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.ts +++ b/public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.ts @@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [ { path: '', redirectTo: '/crisis-center', - terminal: true + pathMatch: 'full' }, { path: 'crisis-center', diff --git a/public/docs/_examples/toh-5/ts/app/app.routes.1.ts b/public/docs/_examples/toh-5/ts/app/app.routes.1.ts index 17f2df4e98..8b4d582680 100644 --- a/public/docs/_examples/toh-5/ts/app/app.routes.1.ts +++ b/public/docs/_examples/toh-5/ts/app/app.routes.1.ts @@ -11,7 +11,7 @@ export const routes: RouterConfig = [ { path: '', redirectTo: '/dashboard', - terminal: true + pathMatch: 'full' }, // #enddocregion redirect-route // #docregion dashboard-route diff --git a/public/docs/_examples/toh-5/ts/app/app.routes.ts b/public/docs/_examples/toh-5/ts/app/app.routes.ts index b4f1f1efa1..33097804eb 100644 --- a/public/docs/_examples/toh-5/ts/app/app.routes.ts +++ b/public/docs/_examples/toh-5/ts/app/app.routes.ts @@ -11,7 +11,7 @@ export const routes: RouterConfig = [ { path: '', redirectTo: '/dashboard', - terminal: true + pathMatch: 'full' }, { path: 'dashboard', diff --git a/public/docs/_examples/toh-6/ts/app/app.routes.ts b/public/docs/_examples/toh-6/ts/app/app.routes.ts index b299102385..1d9adf33fd 100644 --- a/public/docs/_examples/toh-6/ts/app/app.routes.ts +++ b/public/docs/_examples/toh-6/ts/app/app.routes.ts @@ -9,7 +9,7 @@ export const routes: RouterConfig = [ { path: '', redirectTo: '/dashboard', - terminal: true + pathMatch: 'full' }, { path: 'dashboard', diff --git a/public/docs/ts/latest/guide/router.jade b/public/docs/ts/latest/guide/router.jade index f4a50cd506..6b6d14873e 100644 --- a/public/docs/ts/latest/guide/router.jade +++ b/public/docs/ts/latest/guide/router.jade @@ -986,8 +986,11 @@ code-example(format=""). :marked Since we only want to redirect when our path specifically matches `''`, we've added an extra configuration - to our route using `terminal: true`. Mainly for redirects, the `terminal` property tells the router - whether or not it should continue matching our URL against the rest of our defined routes. + to our route using `pathMatch: 'full'`. The `pathMatch` defines the router matching strategy. The default + matching strategy is called `'prefix'` because a match is successful when a route's path is the prefix of + what is in the URL. Since `path: ''` matches any URL prefix, we will cause a redirect by navigating to any URL. + + Now, if we change the matching strategy to `'full'`, the router will apply the redirect only when navigating to '/'. .l-sub-section :marked