嗨,如何将不同的数据传递到一个ejs文件?

时间:2018-07-17 13:49:35

标签: mongoose ejs

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="DummyApp">
  <div ng-controller="DummyController">
    <form>
      <div class="form-group">
        <label for="filterName">Filter by name</label>
        <input type="text" class="form-control" id="filterName" ng-model="filterName">
      </div>
      <div class="form-group">
        <label for="filterTags">Filter by tags</label>
        <input type="text" class="form-control" id="filterTags" ng-model="filterTag">
      </div>
    </form>
    <div class="col-md-7 articles">
      <section>
        <div class="card filter" ng-repeat="article in articles_data | filter:filterName | filter:filterTag">
          <div class="card-header">
            {{article.title}} &nbsp;<small>{{article.tags.join()}}</small>
            <span class="badge badge-{{article.category}} float-right">{{article.category}}</span>
          </div>
          <div class="card-body">
            <p>
              {{article.description}}
            </p>
          </div>
        </div>
      </section>
    </div>
  </div>
</div>

app.get("/logs", (req, res) => {
Log.find({}, (err, logs) => {
    if(err){
        console.log("ERROR!" + err );
    } else {
        res.render("index", {logs: logs});            
    }
  });
});

我该如何进行这项工作。我在ejs端遇到 app.get("/logs", (req, res) => { DailyTask.find( {"created_on":{"$gte":startOfToday, "$lt": now}},(err, tasks) =>{ if(err){ console.log("ERROR => " + err); } else { res.render("index", {tasks: tasks}); } }); }); 错误。任何帮助表示赞赏! 谢谢

0 个答案:

没有答案