I'm struggling on a little problem of mine in a handlebars project. I am working with a set of nested arrays like so:
[
[
[
{Object: "Object1"},
{Object: "Object2"}
],
[
{Object: "Object3"},
{Object: "Object4"}
]
],
[
[
{Object: "Object5"},
{Object: "Object6"}
],
[
{Object: "Object7"},
{Object: "Object8"}
]
],
[
[
{Object: "Object5"},
{Object: "Object6"}
],
[
{Object: "Object7"},
{Object: "Object8"}
]
]
]
I know i can use the @first and @last booleans to know if I'm at the last element of the currently iterating array.
{{#each foo}}
<div class='{{#if @first}}first foo{{/if}}
{{#if @last}} last foo{{/if}}'>
{{@key}} - {{@index}}
</div>
{{/each}}
but what if I want to know whether or not I'm on the last element of a parrent array?
{{#each fooParent}}
{{#each foo}}
<div class='{{#if @first}}first foo not fooparent{{/if}}
{{#if @last}} last foo not fooparent{{/if}}'> <!-- How can I know here
that I am on the
last item of the
fooParent array? -->
{{@key}} - {{@index}}
</div>
{{/each}}
{{/each}}
anyone know how to "get back" in the arrays to know, for example, if I'm on the last element of parent array?