官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 峨山| 东山县| 阿城市| 达日县| 松溪县| 江西省| 济南市| 恩平市| 福海县| 温州市| 互助| 同德县| 普格县| 潮安县| 壤塘县| 鹤峰县| 龙口市| 南昌县| 井陉县| 吉林市| 商南县| 庆阳市| 开原市| 麟游县| 临汾市| 西林县| 扎囊县| 汕头市| 天峨县| 鞍山市| 东丽区| 静宁县| 勐海县| 永福县| 建德市| 峨山| 靖宇县| 绥宁县| 德昌县| 铜陵市| 友谊县|