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

132
Visualizações
Angular route, different behaviour based on logged in status

Maybe not the best approach, but I want to use the same Angular path for both logged in and unauthenticated users to display a component. I have a skeleton component which contains the components after the user has logged in. If the user isnt logged in I dont want to display the skeleton component only the component itself.

routing:

{
    path: '',
    component: SkeletonComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: 'dashboard',
        loadChildren: () =>
          import('./dashboard/dashboard.module').then((m) => m.DashboardModule),
      },
      {
        path: 'opti-inspector',
        loadChildren: () =>
          import('./opti-inspector/opti-inspector.module').then(
            (m) => m.OptiInspectorModule
          ),
      },
      {
        path: '**',
        component: PageNotFoundComponent,
      },
    ],
  },

I want to introduce a protocol component, which is avaialable as both the child of the SkeletonComponent if the user is logged in, or a separate path if the user is not logged in. How could I achieve this?

Unsuccesful trial:

{
    path: '',
    component: SkeletonComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: 'dashboard',
        loadChildren: () =>
          import('./dashboard/dashboard.module').then((m) => m.DashboardModule),
      },
      {
        path: 'opti-inspector',
        loadChildren: () =>
          import('./opti-inspector/opti-inspector.module').then(
            (m) => m.OptiInspectorModule
          ),
      },
      {
        path: 'protocol',
        loadChildren: () =>
          import('./protocoll/protocoll.module').then((m) => m.ProtocollModule),
      },
      {
        path: '**',
        component: PageNotFoundComponent,
      },
    ],
  },
  {
    path: 'protocol',
    loadChildren: () =>
      import('./protocoll/protocoll.module').then((m) => m.ProtocollModule),
  },
about 4 years ago · Juan Pablo Isaza
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