Skip to content Skip to sidebar Skip to footer

Issue Rendering Collection Data In Handlebars Template

I want to render collection in handlebars precompiled templates, this.courses.fetch() is working handlebars view is rendering correctly...(only each loop not rendering collection d

Solution 1:

I don't see here the point where collection fetching is fired. The first line in your courses probably should be this.collection.fetch({ reset: true });

As I see in provided HTML structure, each should be before tr tag. Like this:

<h1>Courses</h1>
<table class="table">
  <thead>
  <tr>
     <th>ID</th>
     <th>Name</th>
  </tr>
  </thead>
  <tbody>
    {{#each models}}
    <tr>
      <td>{{attributes.id}}</td>
      <td>{{attributes.name}}</td>
    </tr>
    {{/each}}
  </tbody>
</table>

Post a Comment for "Issue Rendering Collection Data In Handlebars Template"