Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const CrisisCenterRoutes: RouterConfig = [
{
path: '',
redirectTo: '/crisis-center',
terminal: true
pathMatch: 'full'
},
// #enddocregion redirect
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [
{
path: '',
redirectTo: '/crisis-center',
terminal: true
pathMatch: 'full'
},
{
path: 'crisis-center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const CrisisCenterRoutes: RouterConfig = [
{
path: '',
redirectTo: '/crisis-center',
terminal: true
pathMatch: 'full'
},
{
path: 'crisis-center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [
{
path: '',
redirectTo: '/crisis-center',
terminal: true
pathMatch: 'full'
},
{
path: 'crisis-center',
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/toh-5/ts/app/app.routes.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const routes: RouterConfig = [
{
path: '',
redirectTo: '/dashboard',
terminal: true
pathMatch: 'full'
},
// #enddocregion redirect-route
// #docregion dashboard-route
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/toh-5/ts/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const routes: RouterConfig = [
{
path: '',
redirectTo: '/dashboard',
terminal: true
pathMatch: 'full'
},
{
path: 'dashboard',
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/toh-6/ts/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const routes: RouterConfig = [
{
path: '',
redirectTo: '/dashboard',
terminal: true
pathMatch: 'full'
},
{
path: 'dashboard',
Expand Down
7 changes: 5 additions & 2 deletions public/docs/ts/latest/guide/router.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down