How to iterate over array in handlebar template without defined name in model

Viewed 10141

I have model:

[
  {
    "ID": 5,
    "email": "xx@vflbg.com"
  },
  {
    "ID": 6495,
    "email": "email@monkey.com"
  }
]

Code for iterating in handlebars:

   {{#each xxx}}
    <p>{{email}}</p>
   {{/each}}

how do I define xxx ?

If JSON had name in model like:

   users: [
      {
        "ID": 5,
        "email": "xx@vflbg.com"
      },
      {
        "ID": 6495,
        "email": "email@monkey.com"
      }
    ]

I would simple iterate in handlebars like:

   {{#each users}}
    <p>{{email}}</p>
   {{/each}}
2 Answers
Related