lundi 23 novembre 2015

Ember, how to reuse same "partial" for "index" and for "show"

This is the simplified version of my situation:

<!-- app/templates/charts/index.hbs -->
{{#each model as |chart|}}
  {{partial "charts/chart"}}
{{/each}}

<!-- app/templates/charts/show.hbs -->
{{partial "charts/chart"}}

<!-- app/templates/charts/-chart.hbs -->  
{{chart.title}}

The partial -chart.hbs works well for the index template but not for the show, because for the show the chart is into the variable model.

How can I fix this so I can reuse the same partial for index and for show?




Aucun commentaire:

Enregistrer un commentaire