angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

DI Error

Open martinop opened this issue 9 years ago • 5 comments

OS?

Windows10

Versions.

@angular/cli: 1.0.0-beta.31 node: 7.2.0 os: win32 x64 @angular/common: 2.4.7 @angular/compiler: 2.4.7 @angular/core: 2.4.7 @angular/forms: 2.4.7 @angular/http: 2.4.7 @angular/platform-browser: 2.4.7 @angular/platform-browser-dynamic: 2.4.7 @angular/router: 3.4.7 @angular/cli: 1.0.0-beta.31 @angular/compiler-cli: 2.4.7

Repro steps.

ng serve

The log given by the failure.

Error: DI Error at NoProviderError.ZoneAwareError (http://localhost:4200/polyfills.bundle.js:816:33) at NoProviderError.BaseError [as constructor] (http://localhost:4200/vendor.bundle.js:31581:16) at NoProviderError.AbstractProviderError [as constructor] (http://localhost:4200/vendor.bundle.js:63280:16) at new NoProviderError (http://localhost:4200/vendor.bundle.js:63342:16) at ReflectiveInjector_.throwOrNull (http://localhost:4200/vendor.bundle.js:88631:19) at ReflectiveInjector.getByKeyDefault (http://localhost:4200/vendor.bundle.js:88670:25) at ReflectiveInjector.getByKey (http://localhost:4200/vendor.bundle.js:88602:25) at ReflectiveInjector.get (http://localhost:4200/vendor.bundle.js:88471:21) at AppModuleInjector.get (/AppModule/module.ngfactory.js:364:154) at AppModuleInjector.get (/AppModule/module.ngfactory.js:384:164) at AppModuleInjector.getInternal (/AppModule/module.ngfactory.js:617:50) at AppModuleInjector.NgModuleInjector.get (http://localhost:4200/vendor.bundle.js:64215:44) at CompiledTemplate.proxyViewClass.AppView.injectorGet (http://localhost:4200/vendor.bundle.js:89406:45) at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet (http://localhost:4200/vendor.bundle.js:89834:49) at ElementInjector.get (http://localhost:4200/vendor.bundle.js:88910:27)

Mention any other details that might be useful.

I have a Shared Module that import in the App Module and LoginModule.

When I import the services inside the constructor, get the DI ERROR screenshot_18 screenshot_19 screenshot_20

martinop avatar Feb 11 '17 16:02 martinop

  1. Are you sure your providers in SharedModule includes both the APIService and UtilsService?
  2. Are you sure AppModule imports SharedModule.forRoot() and not just SharedModule?

mattdistefano avatar Feb 11 '17 22:02 mattdistefano

This feels to me it's a problem with Angular itself, not the CLI. You should file an issue on http://github.com/angular/angular. I'm going to close this but if you think that it is a problem with the CLI just answer here.

hansl avatar Feb 12 '17 20:02 hansl

Did you submit the issue to http://github.com/angular/angular ?? I'm having a similar issue

StraightOuttaCrompton avatar Mar 17 '17 18:03 StraightOuttaCrompton

getting the similar issue on my angular2 app, but its not consistent and comes anonymously, any help ?

gtarun avatar Mar 21 '17 05:03 gtarun

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.