- Essential Angular
- Victor Savkin Jeff Cross
- 91字
- 2021-07-02 22:56:27
Bootstrap
To bootstrap an Angular application in the JIT mode, you pass a module to bootstrapModule:
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';
platformBrowserDynamic().bootstrapModule(AppModule);
This will compile AppModule into a module factory and then use the factory to instantiate the module. If you use AOT, you may need to provide the factory yourself:
import {platformBrowser} from '@angular/platform-browser';
import {AppModuleNgFactory} from './app.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
I said "may need to" because the CLI and the WebPack plugin take care of it for you. They will replace the bootstrapModule call with bootstrapModuleFactory when needed.
推薦閱讀
- Spring Cloud Alibaba核心技術與實戰案例
- Objective-C Memory Management Essentials
- Python快樂編程:人工智能深度學習基礎
- Java加密與解密的藝術(第2版)
- 區塊鏈:以太坊DApp開發實戰
- PHP 編程從入門到實踐
- Python數據分析(第2版)
- Java程序設計與實踐教程(第2版)
- Serverless computing in Azure with .NET
- Python全棧數據工程師養成攻略(視頻講解版)
- Unity&VR游戲美術設計實戰
- R數據科學實戰:工具詳解與案例分析
- C++程序設計
- Learning Android Application Testing
- Java高手是怎樣煉成的:原理、方法與實踐