Skip to content Skip to sidebar Skip to footer

How Do I Iterate Over An Array Of Strings With The Meteor Spacebars {{#each}} Block?

I have a Mongo.Collection that holds 'Question' objects. Each 'Question' has a property called choices Questions.insert({ text: 'What is the capitol of the US?', choices: [

Solution 1:

It looks like this was solved in a comment, but just so this question has an answer: you should use this in cases where the current context is a primitive.

<div class="question">
  <div class="question-content">
    <p>{{text}}</p>
    <ul>
      {{#each choices}}
        <li>{{this}}</li>
      {{/each}}
    </ul>
  </div>
</div>

Post a Comment for "How Do I Iterate Over An Array Of Strings With The Meteor Spacebars {{#each}} Block?"