没有找到Angularjs AOT汇编ngfactory?

时间:2017-08-18 10:42:34

标签: angularjs angular2-aot

我正在关注https://angular.io/guide/aot-compiler#compile来研究angularjs中的AOT编译。 AOT编译是成功的,但我无法在浏览器中访问我的应用程序。它显示以下错误: -

localhost /:18错误:(SystemJS)XHR错误(404 Not Found)loading http://localhost:3006/aot/src/app/app.module.ngfactory 来自http://localhost:3006/main.js

它无法找到app.module.ngfactory,但它位于aot生成的目录中。

main.ts文件

import { platformBrowser }    from '@angular/platform-browser';
import { AppModuleNgFactory } from 
'../aot/src/app/app.module.ngfactory';

platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

1 个答案:

答案 0 :(得分:0)

你使用angular-cli吗? 如果有,请使用:ng serve --aot/ ng build --aot来运行您的代码。 这很方便

相关问题