Reputation: 341
I have HomeModule, inside I have imports SharedModule with angular material and ToolbarModule. My doubt is how can I just import SharedModule in HomeModule and exports to all child modules, because I am import SharedModule for the child modules. Follow the code:
@NgModule({
imports: [
CommonModule,
SharedModule,
ToolbarModule
],
exports: [
HomeComponent
]
})
export class HomeModule { }
@NgModule({
imports: [
SharedModule
]
})
export class ToolbarModule { }
What is the best practice? Thanks a lot!
Upvotes: 1
Views: 133
Reputation: 1067
Angular works that way, you will have to import all modules that you need inside the @NgModule. So you will have to import SharedModule
as many times as you need it.
So your code is correct!
Upvotes: 1