Return 在流星空格键模板中按索引排列项目
Return array item by index in a meteor spacebars template
我想访问流星模板中数组的第一项,我使用的语法是:
<p>{{array[0]}}</p>
但是它似乎没有用。我不想使用 {{#each}}
遍历值,只需从数组中选择第一个。
这只是语法问题,正确的是:
<p>{{array.[0]}}</p>
注意到数组 属性 和方括号(数组索引)符号之间的 .
点了吗?
这是相关的(隐藏)文档:
https://github.com/meteor/meteor/wiki/Using-Blaze#dotted-helpers-with-numeric-indices
我想访问流星模板中数组的第一项,我使用的语法是:
<p>{{array[0]}}</p>
但是它似乎没有用。我不想使用 {{#each}}
遍历值,只需从数组中选择第一个。
这只是语法问题,正确的是:
<p>{{array.[0]}}</p>
注意到数组 属性 和方括号(数组索引)符号之间的 .
点了吗?
这是相关的(隐藏)文档:
https://github.com/meteor/meteor/wiki/Using-Blaze#dotted-helpers-with-numeric-indices