Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 955
Andrew Avatar asked Mar 25 '26 01:03

Andrew


1 Answers

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.

like image 190
Andrew Avatar answered Mar 28 '26 01:03

Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!