Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 获取传递到模板的数据_Templates_Meteor_Parameters_Get_Click - Fatal编程技术网

Templates 获取传递到模板的数据

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}}

我是MeteorJS的新手。我尝试使用下载和报告按钮创建列表:

列表模板:

<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();
        },

    });
}