node.js - HandleBars - How to Iterate 2 Collections -
i know how iterate single collection, how iterate multiple collections using handlebars?
below routing file
employeepayslip.find({"employeename":""+name}, function(err, db_payslip){ if(err) throw err; salaryitems.find({"employeename":""+name}, function(err,db_salaryitems){ if(err) throw err; res.render('adminview/pages/examples/payslip-details',{ payslip:db_payslip, salaryitem:db_salaryitems }); }); }); });
how do below,
{{each payslip}} <label>{{employeename}}</label> {{each salaryitem}} <label>{{item}}</label> {{/each}} {{/each}}
if use 1 each, iteration works, if nested it, not seem display data. how display data both collection?
Comments
Post a Comment