I have a JSON data object and a text/html javascript template written using the Moustache syntax. I'm using iCanHaz.js as a template parser.
My problem is that the first row in the data object doesn't get displayed.
Here is my JS code:
var data = jQuery.parseJSON('{"data":[{"title":"Title One"}, {"title":"Title Two"}]}');
var html = ich.data_template(data);
And my Moustache template:
<script type="text/html" id="data_template">
{{#data}}
{{title}}<br />
{{/data}}
</script>
The above code outputs this as my rendered HTML:
<br />
Title Two<br />
As you can see "Title One" from the JSON object isn't displayed.
Does anyone know why? I'm taking a guess it's something to do with my JSON object not being structured correctly (arrays/objects).
Many thanks.