Meteor Iron Router Run function when collection changes -
im new meteor , im trying figure out how run function after collection change.
i have route(iron router) subscribes collection waiton. waits subscrition ready before rendering want.
waiton: function () { return meteor.subscribe('collection', this.params._id); },
any changes collection updated on clients , rendered automatically.
how run function once collection has changed?
you can use ondata
hook, provided you're returning data using data
helper. e.g route may like
this.route('routename', path : '/abc', waiton: function () { return meteor.subscribe('collection', this.params._id); }, data: function() { return collection.findone({_id: this.params.id}); } ondata: function() { //do when data found above changes } });
Comments
Post a Comment