title: Meteor- pass data to nested templates
body: <p>Meteor newbie here.</p>
  
  <p>I have a template for a home page. The home pages has several "day"s in it, which each have "task"s. I want to display the appropriate task in the day that it belongs to, but I don't know how to do this.</p>
  
  <p>I also only want to retrieve the relevant tasks with one database query if possible (ie all tasks within two weeks).</p>
  
  <p>I found a couple other questions possibly related to this including <a href="https://stackoverflow.com/questions/13091914/meteor-how-to-access-parent-properties-within-nested-templates">this</a> and <a href="https://stackoverflow.com/questions/10654255/nested-templates-finding-parent">this</a> but I can't discern any useful related info.</p>
  
  <p>I have a collection for tasks, and as part of the home page I retrieve a two week span of tasks. Then I sort them into day buckets.</p>
  
  <pre><code>buckets = [[...], [...], [...], ... ] # array of arrays of task objects
  </code></pre>
  
  <p>Now I don't know what to do. In the home template, I think I can do</p>
  
  <pre><code>Template.home.helpers(
      tasks: ()-&gt;
          #return buckets, defined above
  )
  (home.coffee)
  
  &lt;template name="home"&gt;
      {{#each tasks}}
           {{&gt; day}}
      {{/each}}
  &lt;/template&gt;
  (home.html)
  </code></pre>
  
  <p>to iterate over the day buckets, but how do I access the task objects from each day template?</p>
  
  <pre><code>&lt;template name="day"&gt;
      {{#each ???}}
          {{&gt; task}}
      {{/each}}
  &lt;/template&gt;
  
  &lt;template name="task"&gt;
      {{name}}
  &lt;/template&gt;
  </code></pre>
  
  <p>How can I access the data from the current iteration of the each loop from the parent template? Am I structuring this incorrectly? Should I just make separate db calls for every day?</p>