[英]Get field value from field name in Meteor template
I have two variables in my template rows
and fields
holding the documents and the field names in the collection, respectively. 我的模板rows
和fields
包含文档和集合中的字段名称两个变量。
I print it with 我用
{{#each rows}}
<tr>
{{#each fields}}
<td>{{name}}</td>
{{/each}}
</tr>
{{/each}}
but right now it just prints the field names instead of the actual values in the documents. 但是现在它仅打印字段名称,而不是文档中的实际值。
I want to obtain something similar to 我想获得类似的东西
{{#each rows}}
<tr>
<td>{{age}}</td>
<td>{{height}}</td>
...
</tr>
{{/each}}
try 尝试
{{#each rows}}
<tr>
{{#each fields}}
<td>{{../name}}</td>
{{/each}}
</tr>
{{/each}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.