我創建幻燈片 - 所以有3個圖像的每一個DIV像這樣每個在灰燼指數以及模和車把
<div>
<img />
<img />
<img />
</div>
</div>
<img />
<img />
<img />
</div>
沒有在互聯網代碼的工作完美無缺 -
http://jaketrent.com/post/every-nth-item-in-handlebars-loop/
http://rockycode.com/blog/handlebars-loop-index/
http://www.arlocarreon.com/blog/javascript/handlebars-js-everyother-helper/
是的,包括堆棧溢出的答案。
任何人都可以提供一些在當前時期完美工作的代碼(Ember/Handlebar版本)嗎?
我有車型的陣列,所以我想這樣做
{{#each model}}
{{if index % 3 == 0}}
{{/if}}
{{/each}}
你有沒有看着HTTP ://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/9405113#9405113有相當多的例子來編寫自定義條件助手。也*索引*可通過'@ index' – colymba