Skip to content

Commit 2ae1739

Browse files
committed
Adding 'How to access global Plotly object code'. closes #92
1 parent d1dd389 commit 2ae1739

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

FAQ.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,22 @@ It's possible disable some plotly events returning `false` in its event. Please
1111

1212
Angular uses the `(click)` directive to itself. If we use the `click` name as event alias to `plotly_click` we might get unexpected behaviour from both angular and plotly.js. We believe it is simpler to just avoid using the same name is better.
1313
Please see issue: https://github.com/plotly/angular-plotly.js/issues/63
14+
15+
16+
## How to access global Plotly object code
17+
18+
If you're using `PlotlyModule`, which includes `plotly.js` via commonjs modules, you can access the `Plotly` object via `PlotlyService`. See the example:
19+
20+
```typescript
21+
import { PlotlyService } from 'angular-plotly.js';
22+
23+
@Component({
24+
selector: 'app-plotly',
25+
template: '...',
26+
})
27+
export class AppPlotlyComponent {
28+
constructor(public plotlyService: PlotlyService) {
29+
const Plotly = plotlyService.getPlotly();
30+
}
31+
}
32+
```

0 commit comments

Comments
 (0)