【发布时间】:2014-08-10 21:03:54
【问题描述】:
我已将大气js.com/package/typeahead 添加到流星项目中,并且运行良好。它返回一个字符串,但我可以更改 typeahead 以返回一个对象并让模板相应地呈现该对象吗?除了要添加到 mongodb-collection 的参与者的名称之外,我还需要 _id。
js 文件:
Template.raceAddParticipant.acparticipants = function () {
return Participants.find().fetch().map(function (post) { return post.name; });
};
html 文件:
<input class="form-control typeahead" autocomplete="off" spellcheck="off" data-source="acparticipants" name="name" type="text" value="" placeholder="Participant" />
问候 克劳斯
【问题讨论】:
标签: mongodb meteor typeahead.js