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
77
88
99import { AppComponent } from './app.component' ;
10+ import { PlotlyViaWindowModule } from 'projects/plotly/src/lib/plotly-via-window.module' ;
1011
1112
1213@NgModule ( {
@@ -16,7 +17,8 @@ import { AppComponent } from './app.component';
1617 imports : [
1718 BrowserModule ,
1819 // PlotlyModule.forRoot(PlotlyJS),
19- PlotlyViaCDNModule . forRoot ( { version : '3.0.1' } ) ,
20+ // PlotlyViaCDNModule.forRoot({version: '3.0.1'}),
21+ PlotlyViaWindowModule ,
2022 ] ,
2123 providers : [ ] ,
2224 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