0

ここで「コンテンツ」項目のそれぞれを反復処理することを検討しています。

    "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": []
        }
}

ハンドルバーでこれを簡単に行うことはできますか? テンプレート内で自動反復する方法が見つからないようです。今私は持っています:

{{#content}}
{{#arr}}
<li>
{{text}}
</li>
{{/arr}}
{{/content}}
</script>
var html = Mustache.to_html(template, {content:arr});
4

0 に答える 0