0
访问数据我有一个课程集合与路线
{courses{{course1_title,id,author,pages[{title,content,model, etc...},
[ etc...]{course2,....}}
我试图通过路由器显示的课程集合内的当前页面的数据
this.route('page', {
path: '/:title',
data: function() {
return courses.findOne({'pages.title':this.params.title};
}
});
我想显示当前像这样的页面的数据:
<template name="page">
<div class ="container page">
<h1>Page</h1>
<!--display current page data -->
<h3>{{title}}</h3>
<div>{{ an other content}} etc..... </div>
</div>
现在,路由器返回次整个课程的数据和显示的标题都是课程的标题。我找不到如何访问当前页面的数据,以便将其显示在页面的模板中。
我试图
return courses.findOne({'pages.title':this.params.title}{fields:{{'pages.title':this.params.title}:1}}
和很多其他的方式。我没有找到它。
什么是正确的方法?
最后,我决定遵循你的建议。非常感谢,MK – michelk 2015-02-10 16:11:33