javascript - Iron router meteor to publish only one item in a collection -
how write publish method iron router gets subscribe on item in collection
meteor.publish('patients', function(){ return newpatient.find(); });
i have tried subscription on routes 1 item still subscribes items in collection figured had publish method. please help
you should add publisher takes id parameter:
meteor.publish('patient', function (patientid) { check(patientid, string); return newpatient.find(patientid); });
then on client, can subscribe this:
meteor.subscribe('patient', this.params._id);
also see subscriptions section of ir guide more details.
Comments
Post a Comment