PlotlyViaWindow Module - Plotly object not found on window error
Closed this issue · 3 comments
I am following the exact steps as mentioned in the document but I am getting Plotly object not found on window while using PlotlyViaWindowModule. Please help
Hello @ssalveMobiltex . Angular version are you using?
also, could you show me the app.module.ts
file to see how the PlotlyViaWindowModule
is being loaded? 'cause this module must receive the plotly object before its initialization
I am using the same imports as in readme file but my module is lazy loaded.
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { PlotlyViaWindowModule } from 'angular-plotly.js';
import { SharedModule } from '../../shared.module';
import { ReadingGraphRoutingModule } from './reading-graph-routing.module';
import { ReadingGraphWrapperComponent } from './reading-graph-wrapper/reading-graph-wrapper.component';
import { ReadingGraphComponent } from './reading-graph.component';
@NgModule({
declarations: [
ReadingGraphComponent,
ReadingGraphWrapperComponent
],
imports: [
CommonModule,
ReadingGraphRoutingModule,
SharedModule,
PlotlyViaWindowModule
]
})
export class ReadingGraphModule { }
eg.
Step 1. Create a shared-plotly.module.ts
Code:
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { PlotlyViaWindowModule } from 'angular-plotly.js';
@NgModule({
declarations: [],
imports: [
CommonModule,
PlotlyViaWindowModule
],
exports: [
CommonModule,
PlotlyViaWindowModule
]
})
Step 2: Import the shared module in your lazy loaded module