I have this in my template:
<canvas id={{radarchart}}></canvas>
and this javascript:
Template.eachitem.helpers({
radarchart: this.data._id + "radar",
});
I’m using charts.js and need to give every item rendered by {{#each...
its own id
or it won’t work (I think it’s obvious why, but I can explain if that helps). I can’t just use {{_id}}
in the template because I have multiple charts to render for each item so I’ve appended radar
in the example.
How would I get the current item’s _id
from Mongo within a helper like this?
Also, is this the best way to deal with giving each item its own unique id?
Edit: more info
I’m using document.getElementById(this.data._id + "radar")
to select the element for the chart to be rendered.