ng-init解析语法错误

时间:2016-02-21 18:31:10

标签: angularjs node.js ejs

我跑这个

res.render('NamesPieChart',{ChartLabels : JSON.stringify(["January","February","March","April","May","June"]), DataList : JSON.stringify(datalist), title : "test"});   

我可以毫无问题地获得datalist。但是,ChartLabels我收到错误:

Syntax Error: Token ',' is an unexpected token at column 47 of the expression [m_datalist=[3,6,2,1,1,2];m_chartlabels=January,February,March,April,May,June] starting at [,February,March,April,May,June].

就像它没有把它看成一个字符串。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

导入ng-init的代码是:

ng-init= "m_datalist=<%-DataList%>;m_chartlabels=<%=ChartLabels%>">