简体   繁体   English

Angular 2 Aot:Zoneware(SystemJS)XHR错误

[英]Angular 2 Aot : Zoneware (SystemJS) XHR error

I am working on Angular Ahead of Time Compilation(AoT), where I have generated build.js file and while loading, stuck with below issue 我正在开发Angular Ahead of Time Compilation(AoT),在那里我生成了build.js文件并在加载时遇到了以下问题

(SystemJS) XHR error (404 Not Found) loading http://localhost:58082/aot/app/app.module.ngfactory

Included below files in index.html 包含在index.html中的文件下面

<script src="shim.min.js"></script>
    <script src="zone.min.js"></script>

Three possibilities of getting this issue 得到这个问题的三种可能性

1) we include this script in index.html page 1)我们在index.html页面中包含此脚本

 <script>window.module = 'aot';</script>

So We have to include in every component the module field along with selector and template 所以我们必须在每个组件中包含模块字段以及选择器和模板

@Component({
    moduleId: module.id,
    selector: 'myapp',
    templateUrl: '../../master/html/test.html'
})

2)This script should be at the bottom of html page 2)此脚本应位于html页面的底部

<script src="dist/build.js"></script>

3)Last but important , No lazy loading for Ahead of time compilation 3)最后但很重要的是,没有延迟加载提前编译

This resolved my issues and app with AOT is running but inside stuck with few issues like Zoneware error of stack undefined.Resolving them. 这解决了我的问题和AOT的应用程序正在运行,但内部卡住了一些问题,例如堆栈未定义的区域错误。解决它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM