我检查了我的代码几次,试图在网络和计算器上发现类似的问题,但现在我的想法已经不存在了,我根本看不到我的错误。你有什么建议,我应该接下来检查什么?当我调试我的配置类时,我可以看到,我的json-Configurations文件被读取,并且值正确地存储到我的配置变量上App-Initialize(请参阅load() - app.config的函数。在plnkr上)。 但是如果我想从这个配置中获取数值,varibales例如的第39行 “werkzeug.service.ts” 出现错误:SyntaxError.ZoneAwareError模块'AppModule'导入的意外值'Http'
let host:string = this.config.getConfig('host');
以下错误:
TypeError: Cannot read property 'host' of null
at AppConfig.getConfig (http://localhost:3000/app/app.config.js:31:27)
at WerkzeugService.getSollIstWerkzeugBySchrankAndAnsicht (http://localhost:3000/app/werkzeug.service.js:47:32)
at AppComponent.ngAfterViewInit (http://localhost:3000/app/app.component.js:37:30)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal (/AppModule/AppComponent/host.ngfactory.js:44:71)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:12206:18)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:12353:48)
at ViewRef_.detectChanges (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:9375:24)
at eval (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:8299:71)
at Array.forEach (native)
at ApplicationRef_.tick (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:8299:29)
at ApplicationRef_._loadComponent (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:8274:18)
at ApplicationRef_.bootstrap (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:8262:18)
at eval (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:8091:93)
at Array.forEach (native)
at PlatformRef_._moduleDoBootstrap
这里是我的项目设置:http://plnkr.co/edit/QsaOtnqFr0Ky9Qwz21SP?p=preview
是您的'@ NgModule'仍在进口的'Http'? – echonax
尽管事实上你已经完全改变了你的问题。你没有'systemjs.config.js'你试图在你的'index.html'中导入。你也没有你的'node_modules'。您可以点击左上方的新建 - > Angular - > 2.0.x为您的angular2模板创建一个新的plunker,并且您不需要编写'.js'和'.js.map'文件 – echonax
我添加了缺失文件systemjs.config.js到plnkr。 – anyones