Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
Secondary router-outlook in child component

Am I allowed to put a secondary router-outlet in any other component other than the AppComponent? Because currently when I do this and I try to activate it using a [routlerLink] I get an error in the console complaining that it cannot find an outlet named popup. If I move it back to AppComponent it works!

So here's the structure of my project:

app/
├──auth/
│  └──login/
│     └──login.component.ts/html/scss
├──landing/
│  ├──landing.module.ts
│  ├──landing.routing.ts
│  └──landing.component.ts/html/scss
├──app.module.ts
├──app.routing.ts
└──app.component.ts/html/scss

And here's the relevant code (landing.routing/landing.component.html):

const routes: Routes = [{
  path: '',
  component: LandingComponent,
  children: [{
    path: 'login',
    component: LoginComponent,
    outlet: 'popup'
  }]
}];
<p>
  <a [routerLink]="[{ outlets: { popup: ['login'] } }]">Login</a>
</p>
<router-outlet></router-outlet>
<router-outlet name="popup"></router-outlet>

...and finally the app.routing.ts routes:

const routes: Routes = [
    { path: 'landing', loadChildren: 'app/landing/landing.module#LandingModule' },
    { path: '', component: HomepageComponent, canActivate: [AuthGuard] },
    { path: '**', component: NotFoundComponent }
];

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda