title: meteor: using nested each-loops
body: <p>I have some problems with understanding using each-loops in meteor. As I have the following SimpleSchema for my DB...</p>
  
  <p><strong>collection.js</strong></p>
  
  <pre><code>dGroup = new SimpleSchema({
      title:      { type: String, optional: true },
      element:    { type: [more], optional: true }
  });
  
  more = new SimpleSchema({
      description: { type: String, optional: true },
      anything:   { type: String, optional: true }
  });
  
  MongoDB.attachSchema(new SimpleSchema({
      mainTitle:  { type: String },
      slug:       { type: String, unique: true },
      language:   { type: String, defaultValue: "en" },
      group:      { type: [dGroup], optional: true },
  }));
  </code></pre>
  
  <p><strong>router.js</strong></p>
  
  <pre><code>data: function () {
      return { 
           result: MongoDB.findOne({
              _id: this.params._id
          }) 
      };
  }
  </code></pre>
  
  <p>... and I want to use an each-loop in an each-loop:</p>
  
  <pre><code>{{#each result.group}}
  &lt;table&gt;
      &lt;caption&gt;{{mainTitle}}&lt;/caption&gt;
      &lt;tbody&gt;
          {{#each element}}
              &lt;tr&gt;
                  &lt;td&gt;&lt;input type="text" value="{{description}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" value="{{anything}}"&gt;&lt;/td&gt;
              &lt;/tr&gt;
          {{/each}}
      &lt;/tbody&gt;
  &lt;/table&gt;
  {{/each}}
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>My problem is how to use elements, which are in the parent elements. In this example I don't get access to the <code>{{mainTitle}}</code> as it is a parent element of the while-loop. </p>