[Chartjs]-Getting String array from node js to ejs

2👍

I found where I was going wrong.

In index.ejs, instead of this…

labels: [<%= value %>],

It should be…

labels: <%- JSON.stringify(country)%>,

Basically the array I was receiving from app.js was kind of [abc,xyz,pqr].
So to convert it to a string array like [‘abc’,’xyz’,’pqr’], we have to use JSON.stringify()

Anyways, thanks folks!

Leave a comment