TypeError: Cannot read property 'forExport' of undefined - when using exporting module
See original GitHub issueHi everybody, I use the latest version of the angular-highcharts module. Everything’s going well so far. However, I get an error as soon as I have used the export function for a diagram and then change the route ( I use the angular router).
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forExport' of undefined TypeError: Cannot read property 'forExport' of undefined at a.Chart.destroy (highcharts.js:264) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.destroy (angular-highcharts.es5.js:345) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.ngOnDestroy (angular-highcharts.es5.js:302) at callProviderLifecycles (core.js:9268) at callElementProvidersLifecycles (core.js:9236) at callLifecycleHooksChildrenFirst (core.js:9226) at destroyView (core.js:10288) at callViewAction (core.js:10414) at execEmbeddedViewsAction (core.js:10357) at destroyView (core.js:10286) at a.Chart.destroy (highcharts.js:264) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.destroy (angular-highcharts.es5.js:345) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.ngOnDestroy (angular-highcharts.es5.js:302) at callProviderLifecycles (core.js:9268) at callElementProvidersLifecycles (core.js:9236) at callLifecycleHooksChildrenFirst (core.js:9226) at destroyView (core.js:10288) at callViewAction (core.js:10414) at execEmbeddedViewsAction (core.js:10357) at destroyView (core.js:10286) 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:3662) 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) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500) at invokeTask (zone.js:1540)
This only happens if I use the export function (no matter if JPG, PDF, PNG or PDF) and then change the route. If I change the route without using the export function, it does not happen.
I think something’s wrong with deleting the export copy.
My import in app.module.ts looks like this:
import highstock from 'highcharts/modules/stock.src'; import exporting from 'highcharts/modules/exporting.src'; import offlineExporting from 'highcharts/modules/offline-exporting.src'; [...] export function highchartsModules() { return [ highstock, exporting, offlineExporting ]; } [...] @NgModule({ [...] providers: [ { provide: HIGHCHARTS_MODULES, useFactory: highchartsModules } ] [...]
- angular: 6.0.4
- angular-highcharts: 6.1.5
- highcharts: 6.1.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
What did it fix? I’m still seeing all of the same errors.
I am facing same issue when routing with svelte. Destroy function along with export module seems to be the culprit here. Need solution.