1

Say i have an fruits object i'm passing to a mustache template.

fruits = { 0 => {name: apple} }

I can do this in the mustache template and all is well

fruits.0.name

BUT what if that index is another variable like i, how do i access that property?

fruits.i.name // does not work
rsahai91
  • 437
  • 4
  • 13

1 Answers1

0

You should avoid this with mustache and try to use iterations. Something like :

fruits = [{name: 'apple'}]

And the iteration

{# fruits}{name}{/ fruits}

If fruits is dependent from an id on an other structure you're iterating on, try to include fruits inside that structure.

Hope it helps.

betelgeuz
  • 309
  • 4
  • 11