Angular 2加载system-config.js时出错



我尝试添加http。看看我的angular应用程序。现在它非常小,我只是在证明功能。所以我是Angular的初学者。应用程序运行良好,直到我尝试添加http。得到的功能。如果我只删除http,我测试应用程序是否再次运行。get请求。但事实并非如此。我必须删除所有其他函数,如错误处理函数。Angular表示,该应用已经成功构建。但是浏览器控制台返回错误:

15:29:48.530 Error: @http://localhost:4200/system-config.js:35:5
    Call@http://localhost:4200/vendor/es6-shim/es6-shim.js:289:14
    forEach@http://localhost:4200/vendor/es6-shim/es6-shim.js:1295:14
    @http://localhost:4200/system-config.js:34:1
    Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:4200/vendor/zone.js/dist/zone.js:323:20
    Zone</Zone</Zone.prototype.run@http://localhost:4200/vendor/zone.js/dist/zone.js:216:25
    scheduleResolveOrReject/<@http://localhost:4200/vendor/zone.js/dist/zone.js:571:53
    Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor/zone.js/dist/zone.js:356:24
    Zone</Zone</Zone.prototype.runTask@http://localhost:4200/vendor/zone.js/dist/zone.js:256:29
    drainMicroTaskQueue@http://localhost:4200/vendor/zone.js/dist/zone.js:474:26
    ZoneTask/this.invoke@http://localhost:4200/vendor/zone.js/dist/zone.js:426:22
    Evaluating http://localhost:4200/system-config.js
    Error loading http://localhost:4200/system-config.js1zone.js:323:20
Zone</ZoneDelegate</ZoneDelegate.prototype.invoke()zone.js:323
Zone</Zone</Zone.prototype.run()zone.js:216
scheduleResolveOrReject/<()zone.js:571
Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask()zone.js:356
Zone</Zone</Zone.prototype.runTask()zone.js:256
drainMicroTaskQueue()zone.js:474
ZoneTask/this.invoke()zone.js:426

我从来没有打开过浏览器控制台,因为应用程序运行得很好。我删除了用http.get添加的所有函数。但现在我得到了同样的错误。我关闭了浏览器控制台,应用程序又运行正常了。如果我在加载应用程序后打开控制台,则不会出现错误信息。当我打开之前,它停止了上面的错误信息。我不明白为什么或什么是错误的system-config.js。我从来没有修改过这个文件,它是由angular cli自动创建的。

system-config.js中的第35行是:

    cliSystemConfigPackages[barrelName] = { main: 'index' };

我真的不知道为什么会出现错误消息为什么在Firefox中打开开发人员工具时会出现错误消息。chrome不会,Firefox只有在加载前打开控制台时才会。

但是http的错误是另一个。我在这里找到了一个解决方案:没有Http

的提供商

最新更新