c3js / c3js/c3

C3 problem (bind "this" to nested API) when used with Angular

Open
#2,388 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

* **C3 version**:
0.6.2
* **D3 version**:
4.13.0
* **Browser**:
any
* **OS**:
any

I'm getting an error when using this library in Angular project, I'm providing c3js as an injectable service and seem that Angular adds a property called `__anonymousType` to **target** function.
When binding this to target chart inside `function Chart' on line 1047 this causes an error:

ERROR TypeError: fn[key].bind is not a function
at c3.js:1047
at Array.forEach ()
at bindThis (c3.js:1046)
at c3.js:1049
at Array.forEach ()
at bindThis (c3.js:1046)
at new Chart (c3.js:1052)

Can a simple check be added **fn[key].hasOwnProperty('bind')** or similar to prevent binding this to any property that other libs may be injecting, this is also future proofing code is some props are not a fn.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.