I am looking for a solution that iron-router is expecting the find method for my collection before rendering.
My route is as follows:
this.route('business', { path : '/business/:type/:_id', waitOn : function () { return Meteor.subscribe('business', this.params._id); }, data : function () { return Business.findOne({_id: this.params._id}); } });
It works great. It seems that the iron router is waiting for a subscription to the Collection to get the correct document for the client. But the data that I need in my template has a delay for the findOne function.
Template.businessItemItem.rendered = function () { console.log(Router.current().data());
Solution For everyone with the same problem. Just add an “action” method for your route as follows:
action : function () { if (this.ready()) this.render(); }
With this method, everything works fine for me.
source share