javascript - Meteor - Passing an object to template but it doesnt display data -


im trying create blog(with meteor) have different categories posts, trying create page displays categories , titles off posts in categories.

this javascript code using.

template.categories.cats = function(){     reviews =   reviews.find({}, {sort: { createdat: -1 } });     opinions = pointlessopinions.find({}, {sort: { createdat: -1 } });     days = daysinthelife.find({}, {sort: { createdat: -1 } });     return {reviews: reviews,opinions: opinions, days: days};   } 

this html template

<template name = "categories">    <div class = "container">     <h1>reviews</h1>      {{#each reviews}}       <h2> {{title}}</h2>      {{/each}}    </div>    <div class = "container">      <h1>a day in life</h1>      {{#each days}}        <a href="/post/{{this._id}}">          <h2> {{title}}</h2>        </a>      {{/each}}    </div>    <div class = "container">     <h1>pointless opinions</h1>     {{#each opinions}}     <a href="/post/{{this._id}}">        <h2> {{title}}</h2>      </a>      {{/each}}    </div> </template> 

i have tested see if collections have data , seems so

you should write this:

template.categories.helpers({     reviews: function (){         return reviews.find({}, {sort: { createdat: -1 } });     },     //and rest of helpers use in template }); 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -