I'm currently working on a somewhat large project and I've decided to break it down into modules. However, I'm facing an issue with accessing the routes of admin.module.ts. In my app.module, I have imported the admin Module.
imports: [
BrowserModule,
CommonModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
NgSelectModule,
AdminModule,
SharedModule
],
The routing module does not include the admin route in my admin.module.ts. The ngModule in admin.module appears as follows:
@NgModule({
declarations: [
AdminComponent,
AdminLandingComponent
], imports: [
CommonModule,
AdminRoutingModule
]
})
The routes in the admin-routing.module.ts are structured like this:
{ path: 'admin', component: AdminComponent, children: [
{ path: '', component: AdminLandingComponent }
]}
Although I am using forChild(), when attempting to access localhost:4200/admin, I get redirected to a page not found error. What could be causing this issue and how can it be resolved?
Full Files
- Parent Module - app module
- Main Routes - app-routing module
- Submodule - admin module
- Child Routes - admin-routing module