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.