1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular 2 optional route parameter

Discussão em 'Angular' iniciado por Jeroen, Maio 19, 2025.

  1. Jeroen

    Jeroen Guest

    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'
    }])

    Continue reading...

Compartilhe esta Página