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