- 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());
}
}
推薦閱讀
- Photoshop智能手機APP UI設(shè)計之道
- 信息可視化的藝術(shù):信息可視化在英國
- Access 數(shù)據(jù)庫應(yīng)用教程
- MySQL 8 DBA基礎(chǔ)教程
- 數(shù)據(jù)結(jié)構(gòu)(Python語言描述)(第2版)
- C語言程序設(shè)計
- TypeScript圖形渲染實戰(zhàn):基于WebGL的3D架構(gòu)與實現(xiàn)
- 青少年P(guān)ython編程入門
- PLC編程與調(diào)試技術(shù)(松下系列)
- INSTANT Passbook App Development for iOS How-to
- 零基礎(chǔ)輕松學C++:青少年趣味編程(全彩版)
- Docker:容器與容器云(第2版)
- Learning Image Processing with OpenCV
- Python Social Media Analytics
- Sitecore Cookbook for Developers