If you need to enumerate over a list of objects, use Handlebar's {{#each}}
helper:
The template inside of the {{#each}}
block will be repeated once for
each item in the array, with the context of the template set to the
current item.
The above example will print a list like this:
<ul>
<li>Hello, Yehuda!</li>
<li>Hello, Tom!</li>
<li>Hello, Trek!</li>
</ul>
Like everything in Handlebars, the {{#each}}
helper is bindings-aware.
If your application adds a new item to the array, or removes an item,
the DOM will be updated without having to write any code.
There is an alternative form of {{#each}}
that does not change the
scope of its inner template. This is useful for cases where you need to
access a property from the outer scope within the loop.
This would print a list like this:
Trek's Friends
<ul>
<li>Trek's friend Yehuda</li>
<li>Trek's friend Tom!</li>
</ul>