문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top