Underscore template display array of objects via _.each
backbone.js, javascript, underscore.js
Solution
Assuming comments is an array on your model:
<% _.each(comments, function(comment) { %>
<p><%= comment.comment %></p>
<% }); %>
Problem
I'm having trouble printing out a simple for each comment loop with _.template. ``` <% _.each([comments], function(i) { %> <p><%= i %></p> <% }); %> ``` prints [object Object] ``` <% _.each([comments], function(i) { %> <p><%= JSON.stringify(i) %></p> <% }); %> ``` prints: ``` [{"comment":"Mauris quis leo at diam molestie sagittis.","id":263,"observation_id":25}] ``` What I've tried so far: ``` <% _.each([comments], function(i) { %> <p><%= i.comment %></p> <% }); %> ``` blank ``` <% _.each([comments], function(i) { %> <p><%= i.get('comment') %></p> <% }); %> ``` Uncaught TypeError: Object [object Array] has no method 'get' ``` <% _.each([comments], function(i) { %> <p><%= comment %></p> <% }); %> ``` blank