Templates 获取传递到模板的数据
我是MeteorJS的新手。我尝试使用下载和报告按钮创建列表: 列表模板:Templates 获取传递到模板的数据,templates,meteor,parameters,get,click,Templates,Meteor,Parameters,Get,Click,我是MeteorJS的新手。我尝试使用下载和报告按钮创建列表: 列表模板: <template name="myBooks"> <div class="container"> <h2>My books</h2> <div class="list-group"> {{#each myBooks}} {{> myBookListItem}} {{/each}}
<template name="myBooks">
<div class="container">
<h2>My books</h2>
<div class="list-group">
{{#each myBooks}} {{> myBookListItem}} {{/each}}
</div>
</div>
</template>
任何人都可以帮助我:?我只需要使用这个。链接。好吧,那太愚蠢了,只能使用这个。链接:你可能想添加这个作为答案,这样其他人就可以看到你的问题不再需要答案了。是的,回答你自己的问题是可以的。
<template name="myBookListItem">
<a class="list-group-item">
<span class="badge badge-success">{{downloads}}</span>
<span class="badge badge-error">{{warnings}}</span>
<h4 class="list-group-item-heading "><i>{{title}}</i> - {{author}}</h4>
<p class="list-group-item-text ">{{description}}</p>
<button type="submit" id="download" class="btn btn-success">Download</button>
<button type="submit" id="report" class="btn btn-danger">Report</button>
</a>
</template>
if (Meteor.isClient) {
Template.myBookListItem.events({
'click #download': function (event) {
//What_kind_of_magic_shoud_i_use_here()
alert();
},
'click #report': function (event) {
alert();
},
});
}