node.js文件
exports.index = function (req, res) {
pool.getConnection(function (err, con) {
con.query('select roll1 from webchart.data', function (err, result) {
if (err) console.error(err);
res.render('index', { title: 'Roll', year: new Date().getFullYear(), parms: result});
});
});
.jade文件
script(type='text/javascript').
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
var a = 1;
function drawChart() {
var dataR1 = new google.visualization.DataTable();
dataR1.addColumn('number', 'time');
dataR1.addColumn('number', 'roll1');
dataR1.addRow([1, #{parms[a].roll1}]);
dataR1.addRow([2, #{parms[2].roll1}]);
500 TypeError:无法读取属性' roll1'未定义的
我怎么能?