Wildcards
We have seen that path expressions can contain two types of segments:
constant segments (for example,
path: 'messages'
)variable segments (for example,
path: ':folder'
)
Using just these two we can handle most use cases. Sometimes, however, what we want is the "otherwise" route. The route that will match against any provided URL. That's what wildcard routes are. In the following example we have a wildcard route
{ path: '**', redirectTo: '/notfound' }
that will match any URL that we were not able to match otherwise and will activate
NotFoundCmp
.
[ { path: ':folder', children: [ { path: '', component: ConversationsCmp }, { path: ':id', component: ConversationCmp, children: [ { path: 'messages', component: MessagesCmp }, { path: 'messages/:id', component: MessageCmp } ] } ] } { path...