【发布时间】:2016-07-21 01:13:42
【问题描述】:
当meteor解析带有{{#each}}模板逻辑的集合时,是否可以只插入特定的数据?
示例:
HTML
{{#each collection}}
<div>
<p>{{collectionparam1}} - {{collectionparam2}}</p>
{{#if **collection[only multiple of 2]**}}
<p>I show this {{collectionparam3}} only each 2 entries</p>
{{/if}}
</div>
{{/each}}
结果:
Billy - 24
Joe - 12
I show this banana only each 2 entries
Bob - 88
Maria - 5
I show this cherry only each 2 entries
Samantha - 102
Henry - 43
I show this apple only each 2 entries
如果可能,我必须在 {{#if}} 逻辑上添加什么?
感谢您的帮助。
【问题讨论】:
标签: templates if-statement meteor collections each