Meteor passing an id into a link

2019-09-16 09:18发布

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条回答
该账号已被封号
2楼-- · 2019-09-16 09:30

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>
查看更多
登录 后发表回答