简体   繁体   English

Angular2 DI 错误 EventEmitter 没有提供者

[英]Angular2 DI Error No provider for EventEmitter

I've a issue at runtime when I try to start my Angular2 application:当我尝试启动我的 Angular2 应用程序时,我在运行时遇到了一个问题:

EXCEPTION: No provider for EventEmitter!例外:EventEmitter 没有提供者!

Error: DI Error at NoProviderError.ZoneAwareError (localhost/js/polyfills.js:4666:33) at NoProviderError.BaseError [as constructor] (localhost/js/vendor.js:11730:16) at NoProviderError.AbstractProviderError [as constructor] (localhost/js/vendor.js:77033:16) at new NoProviderError (localhost/js/vendor.js:77082:16) at ReflectiveInjector_.错误:在 NoProviderError.ZoneAwareError (localhost/js/polyfills.js:4666:33) 在 NoProviderError.BaseError [作为构造函数] (localhost/js/vendor.js:11730:16) 在 NoProviderError.AbstractProviderError [作为构造函数] 的 DI 错误(localhost/js/vendor.js:77033:16) at new NoProviderError (localhost/js/vendor.js:77082:16) at ReflectiveInjector_。 throwOrNull (localhost/js/vendor.js:123981:19) at ReflectiveInjector . throwOrNull (localhost/js/vendor.js:123981:19) 在 ReflectiveInjector getByKeyDefault (localhost/js/vendor.js:124018:25) at ReflectiveInjector . getByKeyDefault (localhost/js/vendor.js:124018:25) 在 ReflectiveInjector getByKey (localhost/js/vendor.js:123968:25) at ReflectiveInjector .get (ocalhost/js/vendor.js:123730:21) at AppModuleInjector.get (/AppModule/module.ngfactory.js:213:131) at AppModuleInjector.getInternal (/AppModule/module.ngfactory.js:688:61) at AppModuleInjector.NgModuleInjector.get (localhost/js/vendor.js:77948:44) at CompiledTemplate.proxyViewClass.AppView.injectorGet (localhost/js/vendor.js:124739:45) at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:15:173) at CompiledTemplate.proxyViewClass.AppView.createHostView (localhost/js/vendor.js:124695:21) getByKey (localhost/js/vendor.js:123968:25) at ReflectiveInjector .get (ocalhost/js/vendor.js:123730:21) at AppModuleInjector.get (/AppModule/module.ngfactory.js:213:131) at AppModuleInjector.getInternal (/AppModule/module.ngfactory.js:688:61) at AppModuleInjector.NgModuleInjector.get (localhost/js/vendor.js:77948:44) at CompiledTemplate.proxyViewClass.AppView.injectorGet (localhost/js/vendorGet) .js:124739:45) 在 CompiledTemplate.proxyViewClass.View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:15:173) 在 CompiledTemplate.proxyViewClass.AppView.createHostView (localhost/js/vendor.js:124695) 21)

But I've no idea where it comes from...但我不知道它来自哪里......

Here is my tsconfig:这是我的 tsconfig:

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    // option for momentjs compilation
    "allowSyntheticDefaultImports": true
  },
  "compileOnSave": false,
  "buildOnSave": false,
  "awesomeTypescriptLoaderOptions": {
    "forkChecker": true,
    "useWebpackText": true
  },
  "exclude": [
    "node_modules",
    "dist",
    "src/custom-typings",
    "typings/index.d.ts",
    "typings/globals/core-js/index.d.ts",
    "typings/globals/node/index.d.ts",
    "typings/globals/jasmine/index.d.ts"
  ]
}

And I'm using 'awesome-typescript-loader', 'angular2-template-loader' , 'angular2-router-loader'.我正在使用 'awesome-typescript-loader'、'angular2-template-loader'、'angular2-router-loader'。

Any idea?任何的想法?

I've found the issue!我发现问题了! Chrome has not showing the good information... Firefox and IE indicate the service that causes the issue SlimLoadingBarService. Chrome 没有显示好的信息... Firefox 和 IE 指出导致问题 SlimLoadingBarService 的服务。

Then I've seen that it was registered on github: https://github.com/akserg/ng2-slim-loading-bar/issues/32然后我看到它是在github上注册的: https : //github.com/akserg/ng2-slim-loading-bar/issues/32

Thanks Günter for editing the post.感谢 Günter 编辑这篇文章。 How could I made it myself next time?下次我怎么能自己做呢?

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

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