kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 192 forks source link

Single Subscription isn't working #487

Closed sharathbangera6 closed 8 years ago

sharathbangera6 commented 8 years ago

Hi,

I am trying to get the single Post using the Subscribe and publish method and using Flow router but the code doesn't seem to work. When i console the id that are passed it display with {{ID}}. Is it correct ? should it have those flower brackets ?

Not Sure what's wrong here. No Error but no data is showing up.

Template.studentSingleView.onCreated(function(){ var self = this; self.autorun(function(){ var Id = FlowRouter.getParam('id'); self.subscribe('singleStudent', Id); }); });

Template.studentSingleView.helpers({ studenthistory: function(){ var id= FlowRouter.getParam('id'); return attendanceRegCol.findOne({_id: id}); } });

if (Meteor.isServer) { Meteor.publish("attendanceRegister", function() { return attendanceRegCol.find({}); });

Meteor.publish('singleStudent', function(id) { check(id, String); return attendanceRegCol.find({_id: id}); }); }

pages.route( '/:id', { name: 'singleView', action: function( params ) { BlazeLayout.render('studentSingleView'); } });

arunoda commented 8 years ago

This is a question you should ask on Meteor Forums.