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);
});
});
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.
Loading....
{{/if}}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'); } });