Iterating through a double array in Mustache

236 Views Asked by At

I have a double array that I'm passing into my Mustache file and the first two levels are indexed by number. The variable name is {{groups}} so I can iterate through the outer part with {{#groups}}{{/groups}} but within each group is an array of questions.

I want to be able to iterate through each question and create some html for each. How can I do this if the references are numerical?

1

There are 1 best solutions below

0
bobthecow On

It'd be easier to give you an answer if you provided some code and/or data examples, but the gist of it is that you need an implicit iterator:

{{# groups }}
  {{# . }}
     <!-- this section will happen once per element in each element of groups -->
  {{/ . }}
{{/ groups }}