<li lat="{{ll[0]}}" lng="{{ll[1]}}">{{name}}</li>
ll is a two item array [47, -122]
Is this valid or do I have to write a function to extra the item at index I want?
Thanks!
{{ll.0}}
and {{ll.1}}
will work in most mustache implementations... haven't tried it in mustache.js though :)
Thanks, I'll give that a try.
Indeed, if you're using 0.5 (currently on master) you can do something like this:
mustache.render("{{a.0}}", {a: ['hi']})
=> 'hi'
this should be on the documentation, it's very usefull. You can even do this if you are int he current item: {{0}}
how can I use another {{variable}} as the index?
i.e. {{my_array.{{my_index}}}}
@piazera You can't. Mustache feels like that's one step too far over the "logic-less" line.
Why can't mustache do this like a normal person and use [0] for indexing? This is really messy.
Most helpful comment
Why can't mustache do this like a normal person and use [0] for indexing? This is really messy.