集合内的流星显示数组
Meteor display array inside a collection
我想创建一个带有标签的帖子模型,并能够显示每个帖子的所有标签。你知道最好的方法吗?
I tried this
<template name='postsLists'>
{{#each post}}
{{> postDetails }}
{{/each}}
</template>
<template name='postDetails'>
title: {{title}}
{{#each tag}}
{{tag}}
{{/each}}
</template>
您需要使用this
关键字从数组中获取值:
<template name='postDetails'>
title: {{title}}
{{#each tag}}
{{this}}
{{/each}}
</template>
这段代码不起作用:
{{#each tag}}
{{tag}}
{{/each}}
因为这里的"tag"既指列表又指列表中的一个元素。试一试:
{{#each tags}}
{{tag}}
{{/each}}
相关文章:
- Jquery/Javascript:通过按下按钮显示数组中的随机图像
- 以angular.js显示数组
- 我想使用Javascript中的循环在HTML中的特定id中显示数组中的多个对象
- Javascript-如何在窗体上方显示数组的值
- 在表中显示数组对象
- 在两个位置显示数组中的随机单词
- 如何显示数组中的图像?JavaScript
- 在页面上显示数组
- 如何使用JavaScript/AngularJS在控制台中显示数组长度
- 流星:显示数组数据,因为表在添加新列时给出了重复值
- 显示数组的内容
- 如何在 JavaScript 中显示数组的所有元素
- jQuery:如何在不使用每个循环的情况下显示数组的第一个元素
- Jquery UI 自动完成中的 PHP 显示数组
- 如何通过单击显示数组和按钮
- ng-重复不显示数组中的值
- 如何在流星中显示数组
- 在输入数组元素时在 html 页面中显示数组元素
- Javascript 如何在新行上显示数组的每个元素
- 显示数组中的图像不起作用