4.修改 main.ts 檔案以使用 NgFactory 和靜態平臺瀏覽器

// this is the static platform browser, the usual counterpart is @angular/platform-browser-dynamic.
import { platformBrowser } from '@angular/platform-browser';

// this is generated by the angular compiler
import { AppModuleNgFactory } from './ngfactory/app/app.module.ngfactory';

// note the use of `bootstrapModuleFactory`, as opposed to `bootstrapModule`.
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

此時,你應該能夠執行你的專案。在這種情況下,我的專案是使用 Angular-CLI 建立的。

> ng serve