mercredi 1 juillet 2015

Conditionally starting and ending a div using each helper

I am using bootstrap and need to conditionally start a <div class="row"> depending on the index of the item; in this case, each row has two items.

{{#each items as |item index|}}
  {{#if item.isStartRow}}
      <div class="row">
  {{/if}}

  ...my code here

  {{#if item.isEndRow}}
      </div>
  {{/if}}
{{/each}}

The trouble is that the ember-cli compiler validates the div has a starting and ending tag, therefore the above will not work. Can anyone suggest a workaround?




Aucun commentaire:

Enregistrer un commentaire