0

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.

Himanshu Yadav
  • 13,315
  • 46
  • 162
  • 291
  • Yeah, but it seems that it's the expected behavior, right? Can you explain a little bit more what you're trying to achieve? – Tomasz Lenarcik Sep 17 '14 at 07:45
  • 1
    Perhaps [`Router.go()`](https://github.com/EventedMind/iron-router#using-routes) is what you wanted to use? – Hubert OG Sep 17 '14 at 07:51

0 Answers0