meteor - Handlebar doesn't render a collection field correctly -


i'm having problem trying use collection field named created in template. reserved word, or something?

the part of template that's struggling looks this:

{{#each threads}}     <tr>         <td><a href="forumshowthread?id={{_id}}">{{topic}}</a></td>         <td>{{creator.username}}</td>         <!-- line below evil one. -->         <td>{{created}}</td>         <td>{{lastpost.poster.username}} {{datetime lastpost.posted}}</td>     </tr> {{/each}} 

the threads find in console in browser following:

[ 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 shoot" __proto__: object ] 

obviously 3 threads, , have created field. browser shows following:

<tr>     <td><a href="forumshowthread?id=czmf5mfqzrb28slpb">and shoot</a></td>     <td>peppe l-g</td>     <td></td>     <td>peppe l-g 7 august 2013 15:50</td> </tr>  <tr>     <td><a href="forumshowthread?id=xafemvavcrzpbkxg3">testnign again</a></td>     <td>peppe l-g</td>     <td></td>     <td>peppe l-g 7 august 2013 15:36</td> </tr>  <tr>     <td><a href="forumshowthread?id=ngetonq8xm36ktg3s">testing</a></td>     <td>peppe l-g</td>     <td></td>     <td>peppe l-g 7 august 2013 15:35</td> </tr> 

why isn't created field showed?

i tried use <td>{{this.created}}</td> instead of <td>{{created}}</td>, , browser shows following:

<tr>     <td><a href="forumshowthread?id=czmf5mfqzrb28slpb">and shoot</a></td>     <td>peppe l-g</td>     <td>1375883440242</td>     <td>peppe l-g 7 august 2013 15:50</td> </tr>  <tr>     <td><a href="forumshowthread?id=xafemvavcrzpbkxg3">testnign again</a></td>     <td>peppe l-g</td>     <td></td>     <td>peppe l-g 7 august 2013 15:36</td> </tr>  <tr>     <td><a href="forumshowthread?id=ngetonq8xm36ktg3s">testing</a></td>     <td>peppe l-g</td>     <td></td>     <td>peppe l-g 7 august 2013 15:35</td> </tr> 

the created field works first thread, not rest. what's going on?!

in case it's relevant, here's entire template:

<template name="pageforumsubcategory">     <div class="layoutcontentforumsubcategory">         {{#with subcategory}}             <h1>                 <a href="forum">forum</a>                 →                 {{name}}                 {{#if currentuser}}                     →                     <a href="forumcreatenewthread?id={{_id}}">new thread</a>                 {{/if}}             </h1>             {{#if threads.count}}                 <table border="2">                     <thead>                         <tr>                             <th>topic</th>                             <th>creator</th>                             <th>created</th>                             <th>last post</th>                         </tr>                     </thead>                     <tbody>                         {{#each threads}}                             <tr>                                 <td><a href="forumshowthread?id={{_id}}">{{topic}}</a></td>                                 <td>{{creator.username}}</td>                                 <!-- line below eveil one. -->                                 <td>{{this.created}}</td>                                 <td>{{lastpost.poster.username}} {{datetime lastpost.posted}}</td>                             </tr>                         {{/each}}                     </tbody>                 </table>             {{else}}                 <p>well, it's more or less empty here (so far).</p>             {{/if}}         {{else}}             <h1>                 <a href="forum">forum</a>                 →                 ???             </h1>             <p>hmm... there no subforum given id. strange, there's nothing can it. sorry.</p>         {{/with}}     </div> </template> 

all templates have created property, callback (run when template created). easiest solution call field else createdat instead.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -