node.js - display array of json objects using handlebar in nodejs & express -


i'm new node , trying retrieve data mongodb , display client.i'm using handlebars purpose.i'm retrieving data mongo collection it's array of json objects not display in html. here code snippets : retrieving mongodb:

usrrouter.route('/profile/projects')     .get(function(req,res){             project.find({pusername:usern},function (err,projects) {                 if(err){console.log(err); }                 else{                     res.render('projects',{"project":projects})                 }             });      }); 

it's results: take on screenshoot

html code:

<table class="table table-striped">                     <thead>                     <tr>                         <th>project name</th>                         <th>project type</th>                         <th>project description</th>                         <th>actions</th>                     </tr>                     </thead>                     <tbody>                         {{#each project}}                 <tr>                     <td> {{projectname}} </td>                     <td> {{projecttype}} </td>                     <td> {{projectdesc}} </td>                     <td> <button class="btn btn-primary">delete</button>                          <span> <button class="btn btn-primary"> <i class="icon-download-alt"></i> download</button>                          </span> </td>                 </tr>                             {{/each}}                     </tbody>                 </table> 


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -