I am frustrated with the lack of documentation around Iron Router and Collections/publish/subscribe. I have some Publish statements (on the isServer part of the code in the site) that return data from Collections to the client. I call them in the route like this:
Router.route('/project/:_id', {
path: '/project/:_id',
template: 'project',
waitOn: function(){
return Meteor.subscribe( "getProject", this.params._id );
}
At this point, I have a server capable of sending a published data set to the client. I have a client asking to subscribe to that data set. That should be all I need for a functional page, right? BUT, Iron Router barks at me when I don't include a data: field like this in the Route:
data: function() {
return Projects.find();
}
Why do I need a data: if I should already have the data I want on the Meteor.subscribe? Can someone explain why this is necessary? I don't want Projects.find() results in the Template, I want the result of Meteor.subscribe("getProject"). Tried to call getProject in the data: part but it wants a collection not a publish/subscription.
This is frustrating because it seems like the most basic task: render a page and use the result set provided by the server. Am I missing something more than that? Basic LAMP can render data pretty easily.