Have you worked with iron router before? Sounds like you might want to start! Very roughly, you’d have a route for your “list” and a route for the “detail” views.
Router.map(function(){
this.route('things', { path: '/things' }); // List of the people or whatever
this.route('thing', { path: '/thing/:_id'}); // View a specific entity
});
in js you’d call the ‘thing’ route like this
Router.go('thing', {_id: thingId});
or you could just make it a link in your template with this special pathFor helper included in iron-router
<td><a href="{{pathFor 'thing'}}">View</a></td>
You maybe wondering: “Wait! You’re not passing any “id” in there. How does it know which id to pass to the route?”
Magic! iron-router will automatically pass the {{id}} from the current data context. Here’s another example which shows the wider context
first the route
...
this.route('admin.order.show', { path: '/admin/order/:_id', });
...
Now a template fragment
...
{{#each orders}}
<tr>
<td>{{status}}</td>
<td><a href="{{pathFor 'order.show'}}">{{orderNumber}}</a></td>
<td>{{date createdAt "short"}}</td>
</tr>
{{/each}}
...
So here you can see we are building some table rows. We are looping through order and building some td elements. In one of them we are building links. Since admin.order.show expects an “id” (as defined in the route) iron-router will pass it automatically. But you can also override if it you want using the WITH helper (see iron router guide, link at bottom)
There are a lot of iron-router tutorials on the web to help you get started. But just to continue for a moment, so the “id” is getting passed to the route, and the controller for that route will have access to the “id” and you can use it there to construct a data context for the template
here is what the controller might look like this, passing it the “id”
OrderShowController = RouteController.extend({
waitOn: function() {
return [
Meteor.subscribe('order', this.params._id),
];
},
data: function() {
return {
order: Orders.findOne(this.params._id),
};
},
});
Guide for iron router