'Angular redirect to module

I have a module called page with its own routing. In my root app.routing.module I redirect to the page module. and in the page module I have a page.routing.module file and I want to redirect to a component and that's where I can't do it.

I don't see my error.

app.routing.module // Project Root file

const routes: Route: [

{ path: '', pathMatch: 'full', redirectTo: 'page' },
{ path: 'page', loadChildren: () => import('page/page.module').then(m => m.PageModule )

]

It works, I am redirected to the page.

page.routing.module

const routes: Route: [

{ path: '', component: PageComponent },

]

page

page
 - page.component.html
 - page.component.css
 - page.component.spec.ts
 - page.routing.module.ts
 - page.module.ts

I want to display PageCompoent



Solution 1:[1]

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})

please try to change the page.routing.module forRoot to forChild

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1