0

Looking to iterate over each of the "content" items here:

    "content": {
        "0": {
            "artifact_id": "36",
            "timestamp": "2013-08-20 11:59:00",
            "modified": "2013-08-20 11:59:00",
            "text": "Why did the last one duplicate? I don't think I clicked it twice...",
            "author_desc": "",
            "object_type": "artifact",
            "comments": []
        },
        "1": {
            "artifact_id": "35",
            "timestamp": "2013-08-20 11:57:51",
            "modified": "2013-08-20 11:57:51",
            "text": "This is a new artifact for a new day.",
            "author_desc": "",
            "object_type": "artifact",
            "comments": []
        },
        "2": {
            "artifact_id": "34",
            "timestamp": "2013-08-20 11:57:50",
            "modified": "2013-08-20 11:57:50",
            "text": "This is a new artifact for a new day.",
            "author_desc": "",
            "object_type": "artifact",
            "comments": []
        }
}

is it possible to do this easily with Handlebars? I can't seem to find a way to auto iterate inside the template. Right now i've got:

{{#content}}
{{#arr}}
<li>
{{text}}
</li>
{{/arr}}
{{/content}}
</script>
var html = Mustache.to_html(template, {content:arr});
flashpunk
  • 783
  • 2
  • 13
  • 38
  • See http://stackoverflow.com/questions/9058774/handlebars-mustache-is-there-a-built-in-way-to-loop-through-the-properties-of in short: with Handlebar 1.0rc1 use {{#each object}} – tsiki Aug 20 '13 at 18:39
  • Got it.. Should have just used handlebars from the start! – flashpunk Aug 20 '13 at 19:00

0 Answers0