Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!