Meteor passing an id into a link

£可爱£侵袭症+ 提交于 2020-01-06 19:53:21

问题


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 ;)


回答1:


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>


来源:https://stackoverflow.com/questions/41986310/meteor-passing-an-id-into-a-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!