0

My implementation is as follows:

App Routes :

export const AppRoutes: Routes = [
    {
    path: 'external',
    loadChildren: './_Layouts/external-layout/external-layout.module#ExternalLayoutModule'
  }]

external Routes:

export const ExternalRoutes: Routes = [
  { path: '', component: ExternalComponent, pathMatch: 'full', canActivate: [AuthGuard] },
  { path: 'programmes', component: ProgrammesComponent, canActivate: [AuthGuard] },
];

The issue is when the url is localhost:4200/external it works fine

But when it is localhost:4200/programmes OR localhost:4200/external/programmes

It is not working at all, What i am missing?

Thanks in advance!

1 Answer 1

1

Are you getting any sort of error? What version of Angular?

Also, I think in later versions the loadChildren syntax is as follows:

    loadChildren: () => import('./items/items.module').then(m => m.ItemsModule)

See more here: https://angular.io/guide/lazy-loading-ngmodules

Sign up to request clarification or add additional context in comments.

4 Comments

Dear Ollie, I am using Angular 7, and no there is no error
You need to make { path: 'programmes', component: ProgrammesComponent, canActivate: [AuthGuard] } as a child route in your routing module from external-layout.module
Dear smithnblack, I have already tried but not successful
When i make routes empty it works, but thats not i required: export const AppRoutes: Routes = [ { path: '', loadChildren: './_Layouts/external-layout/external-layout.module#ExternalLayoutModule' }]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.