書名: Essential Angular作者名: Victor Savkin Jeff Cross本章字數: 71字更新時間: 2021-07-02 22:56:27
Injecting NgModules and module initialization
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());
}
}
推薦閱讀
- 程序員面試筆試寶典(第3版)
- AngularJS Testing Cookbook
- Building a RESTful Web Service with Spring
- 深入理解Django:框架內幕與實現原理
- Mastering Spring MVC 4
- Selenium Design Patterns and Best Practices
- INSTANT Django 1.5 Application Development Starter
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- Python機器學習基礎教程
- Mastering Android Development with Kotlin
- Learning Vaadin 7(Second Edition)
- Learning Material Design
- 零代碼實戰:企業級應用搭建與案例詳解
- Data Science Algorithms in a Week
- 青少年學Python(第2冊)