mardi 22 mars 2016

Ember dynamically allocated row and column from model using bootsrap and handlebars

I searched everywhere for hours,books, references, stackoverflow, you name it, could not find an answer. I have data that needs to be displayed in grid, 2 items per row, n rows. I tried some things, but none work. The following code can only display 2 items. They are components..I am using {{each}} but I cannot put a conditional because well, you know. tried using other helpers no luck. No clear reference on how to write your own.

<div class="container-fluid">

<div class="row">
{{#each model as |evt index|}}

{{#unless index}}

<div class="col-md-6">
  {{#event-box event=evt}} {{/event-box}}
</div>
{{/unless}}

{{#if index}}
<div class="col-md-6">
  {{#event-box event=evt}} {{/event-box}}
</div>

{{/if}}


{{/each}}
</div>
</div>



Aucun commentaire:

Enregistrer un commentaire