Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit111c1cb

Browse files
committed
Removing the use ofModuleWithProviders
1 parent84c4189 commit111c1cb

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ If you wish to optimize loading `plotly.js` in a different way, please check bot
173173

174174
###Plotly Via CDN Module
175175

176-
If you want to load`plotly.js`[from a CDN](https://github.com/plotly/plotly.js#use-the-plotlyjs-cdn-hosted-by-fastly), use the`PlotlyViaCDNModule` andcall`forRoot` method withthe version you want to use:
176+
If you want to load`plotly.js`[from a CDN](https://github.com/plotly/plotly.js#use-the-plotlyjs-cdn-hosted-by-fastly), use the`PlotlyViaCDNModule` andset on the`PlotlyViaCDNModule.plotlyVersion` propertythe plotly.js's version you want to use:
177177

178178
```typescript
179179
import {NgModule }from'@angular/core';

‎src/app/plotly-via-cdn/plotly-via-cdn.module.ts‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{NgModule,ModuleWithProviders}from'@angular/core';
1+
import{NgModule}from'@angular/core';
22
import{CommonModule}from'@angular/common';
33

44
import{PlotComponent}from'../shared/plot/plot.component';
@@ -51,18 +51,8 @@ export class PlotlyViaCDNModule {
5151
fn();
5252
}
5353

54-
staticforRoot(config:Partial<{version:string}>):ModuleWithProviders<PlotlyViaCDNModule>{
55-
if(config.version===undefined){
56-
console.warn(`It's strongly recommended that you set a plotly version when using via CDN.`);
57-
config.version='latest';
58-
}
59-
60-
PlotlyViaCDNModule.setPlotlyVersion(config.version);
61-
PlotlyViaCDNModule.loadViaCDN();
62-
63-
return{
64-
ngModule:PlotlyViaCDNModule,
65-
providers:[PlotlyService]
66-
};
54+
staticforRoot(config:Partial<{version:string}>):never{
55+
consturl="https://github.com/plotly/angular-plotly.js#customizing-the-plotlyjs-bundle";
56+
thrownewError(`[PlotlyViaCDNModule] forRoot method is deprecated. Please see:${url}`);
6757
}
6858
}

‎src/app/plotly-via-window/plotly-via-window.module.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{NgModule,ModuleWithProviders}from'@angular/core';
1+
import{NgModule}from'@angular/core';
22
import{CommonModule}from'@angular/common';
33

44
import{PlotComponent}from'../shared/plot/plot.component';
@@ -22,10 +22,8 @@ export class PlotlyViaWindowModule {
2222
PlotlyService.setPlotly(plotly);
2323
}
2424

25-
staticforRoot():ModuleWithProviders{
26-
return{
27-
ngModule:PlotlyViaWindowModule,
28-
providers:[PlotlyService]
29-
};
25+
staticforRoot():never{
26+
consturl="https://github.com/plotly/angular-plotly.js#plotly-via-window-module";
27+
thrownewError(`[PlotlyViaWindowModule] forRoot method is deprecated. Please see:${url}`);
3028
}
3129
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp