ngx-graph: StaticInjectorError for TooltipService

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior Current version of ngx-graph throws error to the console and the graph won’t render when --aot build used, therefore we cannot turn on aot nor build optimizer for production builds.

  StaticInjectorError(Platform: core)[TooltipService -> InjectionService]: 
    NullInjectorError: No provider for InjectionService!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:3228)
    at resolveToken (core.js:3473)
    at tryResolveToken (core.js:3417)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314)
    at resolveToken (core.js:3473)
    at tryResolveToken (core.js:3417)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314)
    at resolveNgModuleDep (core.js:19784)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:20473)
    at resolveDep (core.js:20844)

It doesn’t matter if I use tooltips or not in the graph the above mentioned error exists for both cases.

Expected behavior The grap should be rendered correctly and the app should not throw any error.

Reproduction of the problem Integrate ngx-graph in your app following the provided readme and try to ether run ng serve --aot or create a production angular build.

Please tell us about your environment: npm 6.4.1, Angular CLI 7.1.3, webpack 4.26.0

  • ngx-graph version: 5.1.1 but 5.2.1 also affected
  • Angular version: 7.1.3
  • Browser: all
  • Language: all

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 19

Most upvoted comments

@jadielam Provide InjectionService in AppModule

@NgModule({
declarations: [...],
imports: [...],
providers: [InjectionService]

Facing the same issue and tried all the solution linked before, "@angular/core": "~8.2.14", "@swimlane/ngx-charts": "12.0.1", "@swimlane/ngx-graph": "^6.2.0", Does anyone have the solution?? adding or removing the modules (graph and chart) doesn’t seem to solve nothing and neither adding the InjectionService to the providers 😕

In my case the problem only occurs in production… removing NgxChardModule doesnt help and providing InjectionService doesnt help neither

@nikolovski I tried this and the problem persists. @zolee I can’t remove this import because I’m using NgxCharts directly for other components.