There is a collection of Posts.
Creating a Link
of each post on the home page.
Need to show post specific data when a link is clicked.
It works fine and show data on new url but don't do anything if Url is given as root /
.
HomePage.html
<template name="homePage">
<h2>Welcome to home page!</h2>
{{#each posts}}
<a href="{{pathFor 'postPage'}}">Link</a>
{{/each}}
</template>
Router.js
this.route('postPage', {
path: '/posts/:_id',
data: function() { return Posts.findOne(this.params._id)}
});
Post.html
<template name="postPage">
<div class="container">
<span>{{note}}</span>
</div>
</template>
Issue is that post specific data goes to a new url and user has to click back to click on other links.
It didn't work when I tried to change router path to path:/
Want to show post specific data on home page itself with all the links on top of it.