Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda