Express-handlebars不显示对象的属性

问题描述

我正在使用 我不确定它是特定于把手还是纯JavaScript。在我的控制器中,我使用以下代码发送数据以供查看:

router.get('/list',(req,res)=> {
    Employee.find((err,docs)=> { //test
        if (!err){
            console.log(docs); 
            res.render("employee/list",{
                list: docs
            }); 
        }else {
            console.log ("Error in retrieving employee list :" + err) ;
        }
    });
})

在视图文件(.hbs)中,我的代码如下:

<table class="table table-striped"> 
    <thead> 
        <tr> 
            <th>Full Name</th>
            <th>Email</th>
            <th>Mobile</th>
            <th>City</th>
            <th></th>
            
        </tr>
    </thead>
    <tbody> 
        {{#each list}} 
        <console class="log">{{this}}</console>
        <tr> 
            <td>{{this.fullName}} </td>
            <td>{{this.email}} </td>
            <td>{{this.mobile}} </td>
            <td>{{this.city}} </td>
            
            <td>
                <a> <i class="fa fa-pencil fa-lg" aria-hidden="true"></i> </a>
                <a> <i class="fa fa-trash fa-lg" aria-hidden="true"></i> </a>
            </td>
        </tr>
        {{/each}}   
    </tbody>

    
</table>

我注销的对象似乎可以正常显示数据。但是表单元格的内容不包含。 我确定fullNameemailmobilecity中都有数据(来自日志)。

快速车把的版本为:^3.0.0

我应该检查什么?谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)