Reputation:
My app.js
code is :
for (var i=0; i<result.length; i++) {
data['result'][i] = {company_name: result[i].company_name};
}
res.render('findcompany', {data: data});
console.log(data);
result of console.log(data)
is
{result:[{company_name:'a'},{company_name:'b'}]}
and findcompany.pug
code is
doctype html
html
include ./head
body
ul #{data}
but when i run this,i get
[object Object]
please help me, I am stuck here.
Upvotes: 0
Views: 29
Reputation: 73896
You can just do loop on it like:
ul
each val in data.result
li= val.company_name
Upvotes: 1