流星将一个id传递给一个链接 [英] Meteor passing an id into a link

查看:93
本文介绍了流星将一个id传递给一个链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我的数据库正在工作我希望用户点击数据库中的某个东西以获得更详细的视图,但数据的id未插入到链接中

 < template name =meineEvents> 
< ul>
{{#each event}}
< li> {{name}}< / li>
{{/ each}}
< a href =/ eventDetails / {{_ id}}>更多详情< / a>
< / ul>
< / template>

但是当我点击链接时,只能看到 http:// localhost:3000 / eventDetails / 没有id后面的eventDetails / im正在运行Meteor 1.4 with Blaze

感谢您的帮助;你需要把锚定在 {{#each}} 中,

 < template name =meineEvents> 
< ul>
{{#each event}}
< li> {{name}}
< a href =/ eventDetails / {{_ id}}>更多详情< / a> ;< /锂>
{{/ each}}
< / ul>
< / template>


now my database is working i want the user to click on one of the things in the database to get a more detailed view but the id of the data is not inserted in the link

<template name="meineEvents">
  <ul>
    {{#each event}}
      <li>{{name}}</li>
    {{/each}}
    <a href="/eventDetails/{{_id}}">mehr  Details</a>
  </ul>
</template>

but when i click on the link i only see the http://localhost:3000/eventDetails/ without the id behind the eventDetails/ im running Meteor 1.4 with Blaze

Thank you for your help ;)

解决方案

You need to have the anchor inside the {{#each}}

<template name="meineEvents">
  <ul>
    {{#each event}}
      <li>{{name}}
      <a href="/eventDetails/{{_id}}">mehr  Details</a></li>
    {{/each}}
  </ul>
</template>

这篇关于流星将一个id传递给一个链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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