【发布时间】:2014-12-28 21:59:21
【问题描述】:
我刚刚更新到 Meteor 1.0 和最新版本的 Iron-Router。
无论出于何种原因,当我将数据传递给仅包含单个文档的模板时,它都能正常工作。但是当我尝试将多个文档传递给模板时,我得到一个空白屏幕。
//galleryRoute.js
Router.route('/:section', function() {
this.layout('Gallery', {
data: function() {
var data = { photos: photos.find({ path: { $regex: '/'+this.params.section +'/' } }) };
return data;
}
});
});
<template name="Gallery">
<div class="container">
{{#each photos}}
<div class="section-photo" style="background:url({{path}}) no-repeat center center; width:175px; height:175px; background-size:cover;"></div>
{{/each}}
</div>
</template>
想知道是否有人对为什么会这样有任何想法?
【问题讨论】:
-
您的
.find()有返回任何东西吗?尝试获取.find()的结果并记录结果。
标签: javascript meteor iron-router spacebars