MongoDB项目根本不显示

时间:2015-10-22 01:33:18

标签: javascript mongodb meteor

这是我的contact.html文件中的代码

<template name="page1">
  <div id="barHead" class="bar bar-header">
    <button class="button button-clear">Back</button>
    <div class="h1 title">Contacts</div>
    <button class="button button-clear button-positive">Add</button>
  </div><br>
  <div id="contactList">
    {{> conts}}
  </div>
</template>

<template name="conts">
  <ul class="list-group">
    {{#each Contacts}}
      {{> aCont}}
    {{/each}}
  </ul>
</template>

<template name="aCont">
  <li class="list-group-item">{{this.lastname}}, {{this.firstname}}</li>
</template>

这是我的相关JS代码......

models.js

Contacts = new Mongo.Collection("contacts");

contact.js

Template.contacts.helpers({
  contacts: function() {
    return Contacts.find({}, {sort: {lastname: -1}, limit: 10});
  },
});

startup.js

Meteor.startup(function () {
    if(Contacts.find().count() === 0){
        Contacts.insert({firstname:"John", lastname:"Doe", address:"43 Wallaby Way"});
       }
    });

为什么它只显示我的标题栏而不是联系人?

0 个答案:

没有答案