In my ejs i have this code:
<% for(var bill in ChildData){ %>
<tr>
<td><%= bill.id %></td>
<td><%= bill.Phone %></td>
<td><%= bill.Amount %></td>
<td><%= bill.Purchase_Date %></td>
<td>View Details</td>
</tr>
<% } %>
In my node I have
app.get("/viewbill", function(req,res){
database.once("value", function (snapshot) {
res.render('viewbills', {ChildData: snapshot.val()});
});
})
However on the page I obtain Screenshot of the output I get
Even if I try I get the same result
<td><%- JSON.stringify(bill.id) %></td>
Changing ejs code to this gave me the output
<% Object.keys(ChildData).forEach(function(key) { %>
<tr>
<td><%- ChildData[key].id %></td>
<td><%- ChildData[key].Phone %></td>
<td><%- ChildData[key].Amount %></td>
<td><%- ChildData[key].Purchase_Date %></td>
<td>View Details</td>
</tr>
<% }); %>