.hbs文件中的以下代码等效

时间:2018-12-26 18:34:34

标签: node.js handlebars.js express-handlebars

我正在从事一个涉及节点,猫鼬,车把,快递的项目。把手中的以下代码等效于什么?

<div class="panel panel-default" ng-init="getExams()">
 <div class="panel-heading">
    <h3 class="panel-title">Exams</h3>
 </div>
<div class="panel-body">
 <div class="row">
  <div ng-repeat="exam in exams">
    <div class="col-md-6">
      <div class="col-md-6">
        <h4>{{exam.examName}}</h4>
        <a class="btn btn-primary" href="#/exams/details/{{exam._id}}">View Details</a>
      </div>
    </div>
  </div>
</div>

我想在我的模型中显示以下函数输出的所有行。

module.exports.getExams = (callback, limit) => {
Exam.find(callback).limit(limit);
}

1 个答案:

答案 0 :(得分:0)

在node.js中,渲染时: res.render('your view'),{exams:exams} 在车把中:

<div class="panel panel-default">
 <div class="panel-heading">
    <h3 class="panel-title">Exams</h3>
 </div>
<div class="panel-body">
 <div class="row">
 {{#each exams}}
  <div>
    <div class="col-md-6">
      <div class="col-md-6">
        <h4>{{examName}}</h4>
        <a class="btn btn-primary" href="#/exams/details/{{_id}}">View Details</a>
      </div>
    </div>
  </div>
 {{/each}}
</div>