gonewandering / angles

An angular.js wrapper for Chart.js
MIT License
632 stars 87 forks source link

Using "chart" and "type" attributes in canvas tag causes exception #52

Open jstol opened 10 years ago

jstol commented 10 years ago

I'm seeing an issue where using the "type" attribute in a canvas tag to specify chart type seems to cause an exception to be thrown (TypeError: undefined is not a function). For example, doing something like

<canvas chart type="Line" ...></canvas>

rather than

<canvas linechart ...></canvas>

causes an exception to be thrown (at line 62 in angles.js).

... chartCreated = chart[type]($scope.data, $scope.options); ...

If the type attribute is used to specify the chart type within a canvas tag, the type variable in angles.js appears to be undefined, so the function can't be called. Specifying the chart type in a canvas tag using an aliased type (ex. linechart) seems to work just fine, however.

Not 100% sure if the root of the problem lies within angles itself, or if it's an issue on my end. Just thought I would post my experience here to be safe.