Skip to content Skip to sidebar Skip to footer

Rendering An Array As A List Within A Backbone Model

This is an extension to another post I found: Backbone: A list of views inside a view I had trouble understanding this (I've never used underscore before) so I figured it's best to

Solution 1:

I feel like one of the issues is that you do not pass any arguments to _.each method.

<% _.each(participants, function (participant) { %>
   <%= participant.name %>
<% }); %>

Hope it will fix your problem.


Solution 2:

The correct way of using _.each function will be :

<% _.each(participants, function (element,index) { %>
           <%= element.name %>
<% }); %> 

Post a Comment for "Rendering An Array As A List Within A Backbone Model"