Routing on different router outlets

Discussão em 'Angular' iniciado por Michał B, Fevereiro 22, 2025.

  1. Michał B

    Michał B Guest

    I'm trying to use two router outlets, depending on active route. Right now I have something like this:

    <router-outlet></router-outlet>
    <router-outlet name="modal"></router-outlet>


    And in routes config:

    const routes: Routes = [
    {
    path: 'account',
    canActivate: [AuthGuardService],
    component: AccountPageComponent,
    outlet: 'modal',
    },
    {
    path: 'incidents/:id',
    component: IncidentDetailsComponent,
    }
    ]


    When I'm using nameless outlet alone, everything works well. But when second outlet is set following errors appears:


    NG04002: Cannot match any routes. URL Segment: 'incidents/1'


    NG04002: Cannot match any routes. URL Segment: 'account'
    ​

    Do you know how to fix this?

    Thanks

    Continue reading...

Compartilhe esta Página