Angular instantiates NgModules and registers them with dependency injection. This means that you can inject modules into other modules or components, like this:
@NgModule({
imports: [TalksModule]
})
class AppModule {
constructor(t: TalksModule) {}
}
This can be useful for coordinating the initialization of multiple modules, as shown here:
@NgModule({
imports: [ModuleA, ModuleB]
})
class AppModule {
constructor(a: ModuleA, b: ModuleB) {
a.initialize().then(() => b.initialize());
}
}