March 2017
Intermediate to advanced
118 pages
2h 1m
English
We often use redirects for URL normalization. Say we want both
mail-app.vsavkin.com
and
mail-app.vsavkin.com/inbox
render the same UI. We can use a redirect to achieve that:
[
{ path: '', pathMatch: 'full', redirectTo: '/inbox' },
{
path: ':folder',
children: [
...
]
}
]
We can also use redirects to implement a not-found page:
[
{
path: ':folder',
children: [
{
path: '',
component: ConversationsCmp
},
{
path: ':id',
component: ConversationCmp,
children: [
{ path: 'messages', component: MessagesCmp },
{ path: 'messages/:id', component: MessageCmp }
]
}
{ path: '**', redirectTo: '/notfound/conversation' }
]
}
{ path: 'notfound/:objectType', component: NotFoundCmp }
]
Read now
Unlock full access