File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { PlotlyViaCDNModule } from 'projects/plotly/src/lib/plotly-via-cdn.modul
7
7
8
8
9
9
import { AppComponent } from './app.component' ;
10
+ import { PlotlyViaWindowModule } from 'projects/plotly/src/lib/plotly-via-window.module' ;
10
11
11
12
12
13
@NgModule ( {
@@ -16,7 +17,8 @@ import { AppComponent } from './app.component';
16
17
imports : [
17
18
BrowserModule ,
18
19
// PlotlyModule.forRoot(PlotlyJS),
19
- PlotlyViaCDNModule . forRoot ( { version : '3.0.1' } ) ,
20
+ // PlotlyViaCDNModule.forRoot({version: '3.0.1'}),
21
+ PlotlyViaWindowModule ,
20
22
] ,
21
23
providers : [ ] ,
22
24
bootstrap : [ AppComponent ]
Original file line number Diff line number Diff line change
1
+ import { NgModule } from '@angular/core' ;
2
+ import { PlotlyService } from './plotly.service' ;
3
+ import { PlotlyComponent } from './plotly.component' ;
4
+
5
+
6
+ @NgModule ( {
7
+ imports : [ PlotlyComponent ] ,
8
+ providers : [ PlotlyService ] ,
9
+ exports : [ PlotlyComponent ] ,
10
+ } )
11
+ export class PlotlyViaWindowModule {
12
+ constructor ( ) {
13
+ const plotly = ( window as any ) . Plotly ;
14
+
15
+ if ( typeof plotly === 'undefined' ) {
16
+ throw new Error ( `Plotly object not found on window.` ) ;
17
+ }
18
+
19
+ PlotlyService . setPlotly ( plotly ) ;
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments