Is it possible to have an optional route parameter in the Angular 2 route? I tried the Angular 1.x syntax in RouteConfig but received below error:

“ORIGINAL EXCEPTION: Path “/user/:id?” contains “?” which is not allowed in a route config.”

@RouteConfig([
{
    path: '/user/:id?',
    component: User,
    as: 'User'
}])

14 Answers
14

Leave a Reply

Your email address will not be published. Required fields are marked *