MeetmeLeave / ng-canvas-gauges

Angular2 component wrapper for the canvas-gauges library written by @Mikhus(https://github.com/Mikhus/canvas-gauges).
MIT License
38 stars 23 forks source link

valueText="0" is treated as falsy #35

Open doug-a-brunner opened 4 years ago

doug-a-brunner commented 4 years ago

It seems that if, using the JS API (options object), you set valueText to anything that can be parsed as a number, it will be parsed as such and treated as falsy by the underlying canvas-gauges. This can result in some confusing glitches. I found that canvas-gauges on its own suffers from the same problem, but only if you use its HTML attribute API (data-value-text="0" appears falsy, which is really a limitation of the API's design). If you provide it an option object with valueText: "0", it is correctly treated as truthy and rendered.

ng-canvas-gauges should provide its values to canvas-gauges using the JS API to avoid this problem.