I observed an issue with underscore trying to access a data in a HTML property:
For a model with an id and a name properties
<% _.each(collection, function(model){ %>
<div data-id="<% model.id %>" class="item active"><%= model.name %></div>
<% }); %>
Here, i get <div data-id="" class="item active c">Test</div>, if i do:
<% _.each(collection, function(model){ %>
<div data-id="<% model.id %>" class="item active"><%= model.name %></div>
<% }); %>
i get <div data-id="" class="item active c">0</div>
So i can’t print into the “data-id” property, it seems to be because i am in a each because i can do this in another part of my code.
Do you know a way to avoid that ?
Thanks.
You’re just one more
=sign away!