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
Collections 把手不';无法正确呈现集合字段_Collections_Meteor_Render_Handlebars.js - Fatal编程技术网

Collections 把手不';无法正确呈现集合字段

Collections 把手不';无法正确呈现集合字段,collections,meteor,render,handlebars.js,Collections,Meteor,Render,Handlebars.js,尝试在模板中使用名为的集合字段时遇到问题。那是保留字还是什么 模板中挣扎的部分如下所示: {{#每个线程} {{creator.username} {{created}} {{lastPost.poster.username}{{{datetime lastPost.poster}} {{/每个}} 我在浏览器的控制台中找到的线程如下: [ Object _id: "ngEtonq8XM36KtG3S" created: 1375881336372 creator: function (){

尝试在模板中使用名为
的集合字段时遇到问题。那是保留字还是什么

模板中挣扎的部分如下所示:

{{#每个线程}
{{creator.username}
{{created}}
{{lastPost.poster.username}{{{datetime lastPost.poster}}
{{/每个}}
我在浏览器的控制台中找到的线程如下:

[
Object
_id: "ngEtonq8XM36KtG3S"
created: 1375881336372
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testing"
__proto__: Object
, 
Object
_id: "XafEMvAvcRzpBKxG3"
created: 1375882602652
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testnign again"
__proto__: Object
, 
Object
_id: "CZmf5MfqZrB28SLPB"
created: 1375883440242
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "And another shoot"
__proto__: Object
]
显然有三个线程,它们都有一个已创建的字段。但浏览器显示以下内容:

[
Object
_id: "ngEtonq8XM36KtG3S"
created: 1375881336372
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testing"
__proto__: Object
, 
Object
_id: "XafEMvAvcRzpBKxG3"
created: 1375882602652
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testnign again"
__proto__: Object
, 
Object
_id: "CZmf5MfqZrB28SLPB"
created: 1375883440242
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "And another shoot"
__proto__: Object
]

Peppe L-G
Peppe L-G 2013年8月7日15:50
Peppe L-G
Peppe L-G 2013年8月7日15:36
Peppe L-G
Peppe L-G 2013年8月7日15:35
为什么不显示
已创建的
字段

我尝试使用
{{this.created}}
而不是
{{created}}
,然后浏览器显示以下内容:

[
Object
_id: "ngEtonq8XM36KtG3S"
created: 1375881336372
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testing"
__proto__: Object
, 
Object
_id: "XafEMvAvcRzpBKxG3"
created: 1375882602652
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "Testnign again"
__proto__: Object
, 
Object
_id: "CZmf5MfqZrB28SLPB"
created: 1375883440242
creator: function (){
creatorId: "ZmKpMdhP4GtzQo98e"
lastPost: function (){
posts: function (){
subCategory: function (){
subCategoryId: "axgd2xzctkfmphmwM"
topic: "And another shoot"
__proto__: Object
]

Peppe L-G
1375883440242
Peppe L-G 2013年8月7日15:50
Peppe L-G
Peppe L-G 2013年8月7日15:36
Peppe L-G
Peppe L-G 2013年8月7日15:35
创建的
字段现在适用于第一个线程,但不适用于其余线程。怎么回事

如果相关,以下是整个模板:


{{#带子类别}
→
{{name}}
{{{#如果当前用户}}
→
{{/if}
{{{#if threads.count}
话题
造物主
创建
最后一篇文章
{{{#每个线程}
{{creator.username}
{{this.created}}
{{lastPost.poster.username}{{{datetime lastPost.poster}}
{{/每个}}
{{else}
嗯,这里(到目前为止)或多或少是空的

{{/if} {{else} → ??? 嗯。。。没有具有给定id的子窗体。很奇怪,但对此我无能为力。对不起

{{/与}}
所有模板都已具有一个属性,即回调(在创建模板时运行)。最简单的解决方案就是调用字段,比如
createdAt

Hmm。。。当我使用
#each
时,上下文不是被切换了吗?因此,创建的文档
会对创建的模板
产生阴影?或者,显然不是(我测试过,你是对的)。但是现在我明白了为什么集合
Meteor.users
中有一个名为
createdAt
的字段,我发现这个字段有点奇怪^^