集合内的流星显示阵列 [英] Meteor display array inside a collection

查看:26
本文介绍了集合内的流星显示阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有标签的帖子模型,并且能够显示每个帖子的所有标签.你知道最好的方法吗??

I want create a posts model, with tags, and be able to display all tags for each post. You know a best way to do it ??

我试过了

<template name='postsLists'>
  {{#each post}}
    {{> postDetails }}
  {{/each}}
</template>


<template name='postDetails'>
  title: {{title}}
  {{#each tag}}
    {{tag}}
  {{/each}}
</template>

推荐答案

您需要使用 this 关键字从数组中获取值:

You need to use this keyword to get value from an array:

<template name='postDetails'>
  title: {{title}}
  {{#each tag}}
    {{this}}
  {{/each}}
</template>

这篇关于集合内的流星显示阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆