Skip to content

Instantly share code, notes, and snippets.

@anova
Created October 15, 2014 13:52
Show Gist options
  • Save anova/c65b3bca27fea4ec1ce3 to your computer and use it in GitHub Desktop.
Save anova/c65b3bca27fea4ec1ce3 to your computer and use it in GitHub Desktop.
How to render array with mustache.js
<script id="child-template" type="text/mustache">
{{#.}}
<div class="child-wrapper">
<div class="child-name-wrapper">{{name}}</div>
<div class="child-birthdate-wrapper">{{birthdate}}</div>
<div class="child-gender-wrapper">{{gender}}</div>
</div>
{{/.}}
</script>
<!--
var template_code = document.getElementById('child-template').innerHTML;
var data = [
{name: 'John Doe', birthdate: '01/01/2011'},
{name: 'Jane Doe', birthdate: '01/01/2011'}
];
Mustache.render(template_code, data);
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment