[英]Looping in Handlebars
我正在努力查看如何将Handlebars与简单的字符串数组一起使用。 我有以下对象
当遍历searchParam数组时,我使用类似以下内容:
{{#each model.searchParam}}
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="th-narrow">Property</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="label">name</span></td>
<td>{{name}}</td>
</tr>
<tr>
<td><span class="label">type</span></td>
<td>{{type}}</td>
</tr>
</tbody>
</table>
{{/each}}
在上图中,如何在“ searchInclude”数组周围循环?
{{#each model.searchInclude}}
... wht do I reference here for the contents of the array?
{{/each}}
在阵列的情况下, this
将是的值,并可以得到与车把magic关键字索引@index
{{#each model.searchInclude}}
{{@index}}: {{this}}
{{/each}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.