Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No provider for ModuleBasedServiceService! #1

Open
web-dave opened this issue Jun 21, 2018 · 2 comments
Open

No provider for ModuleBasedServiceService! #1

web-dave opened this issue Jun 21, 2018 · 2 comments

Comments

@web-dave
Copy link
Owner

Circular dependency detected:
src\app\lazy\lazy-routing.module.ts -> src\app\lazy\lazy.component.ts -> src\app\lazy\module-based-service.service.ts -> src\app\lazy\lazy.module.ts -> src\app\lazy\lazy-routing.module.ts
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[LazyComponent -> ModuleBasedServiceService]: 
  StaticInjectorError(Platform: core)[LazyComponent -> ModuleBasedServiceService]: 
    NullInjectorError: No provider for ModuleBasedServiceService!
Error: StaticInjectorError(AppModule)[LazyComponent -> ModuleBasedServiceService]: 
  StaticInjectorError(Platform: core)[LazyComponent -> ModuleBasedServiceService]: 
    NullInjectorError: No provider for ModuleBasedServiceService!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:979)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveNgModuleDep (core.js:9217)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9911)
    at resolveNgModuleDep (core.js:9217)
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:979)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveNgModuleDep (core.js:9217)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9911)
    at resolveNgModuleDep (core.js:9217)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4053)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
@web-dave
Copy link
Owner Author

We have to serve the lazyService in a seperate module to breake the circular dependency
(done in this commit 6257f21

@web-dave
Copy link
Owner Author

AppModule <= LazyModule <= ServiceModule <= EurostarService
@Injectable({ providedIn: ServiceModule })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant