i have exceeded the 2MB mark a while ago, so i decided to implement Lazy loading to deal with my hefty batches. Therefore I have questions regarding imports, entryComponents and providers. To water all of them down into one question:
What do i import into app-routing.module.ts and what do import into login-routing.module.ts
since i use:
- angular modules
- angular material modules(mat dialogs, hence the entry components)
- numerous services(only some are called in all components)
- other npms
This my app-routing.module.ts:
const routes: Routes = [
{
path: '',
component: AppComponent,
children: [
{
path: '',
pathMatch: 'full',
redirectTo: '/login'
},
{
path: '**',
component: LoginComponent
},
{
path: 'login',
loadChildren: () => import('./account/login/login.module').then(m => m.LoginModule)
}
]
}
@NgModule({
imports: [RouterModule.forRoot(routes, {useHash: true})],
exports: [RouterModule]
})
export class AppRoutingModule { }
This is my login-routing.module.ts:
const routes: Routes = [
{
path: '',
component: LoginComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class LoginRoutingModule { }