Search code examples
backbone.jscoffeescripteco

Strange Eco Template Behavior


I am using Backbone and Eco templates in my Rails application. My template has the following code:

  <% @collection.each (model)-> %>
    <% console.log model.get('name') %>
    <p><%= model.get('name') %></p>
    <p><%= model.get('description') %></p>
  <% end %>

For some reason, the HTML is blank. The name and description are not displayed. However, the console.log method outputs the correct data. What am I doing wrong?


Solution

  • Well I figured out the missing character. Apparently, Eco templates require a colon after the arrow:

    <% @collection.each (model)->: %>
    

    Not sure why this is the case. It's never mentioned in the readme.