vendredi 24 avril 2015

Accessing the current model within a yield

I'm looking for how to access the current model with-in an each from a yield statement. Any ideas?

Model

models: [{
   id: 1,
   name:'Red',
   value: '#ff0000'
}, {
  id: 2,
  name:'Yellow',
  value: '#ffff00'
}, {
  id: 3,
  name:'Blue',
  value: '#0000ff'
}];

Template

{{#table-list models=models config=colorModelTableListConfig}}
  {{model.id}}
  {{model.name}}
  {{model.value}}
{{/table-list}}

Component (table-list)

<!-- Searching markup-->
<table>
  {{#each th in config.tableHeaders}}
    <th>{{th}}</th>
  {{/each}}

  {{#each model in models}}
    {{yield}}
  {{/each}}
</table>
<!-- Pagination markup-->

Side-note I can't throw the each inside the yield, this will cause issues with my searching, pagination and other functionality




Aucun commentaire:

Enregistrer un commentaire