meteor-mysql icon indicating copy to clipboard operation
meteor-mysql copied to clipboard

MysqlSubscription with Router

Open ghost opened this issue 10 years ago • 4 comments

Is it possible to use MysqlSubscription with Iron-Router or Flow-Router?

ghost avatar Jun 20 '15 22:06 ghost

Yes, You can use MysqlSubscription with Iron Router instead of using it on the client file.

Router.route('page', { ...
subscriptions: function() { return [ subsctriptionOne = new MysqlSubscription('name_one'), subsctriptionTwo = new MysqlSubscription('name_two') ] ... } );

VCarrasco avatar Jun 22 '15 06:06 VCarrasco

I cant get this to work, I keep getting the error "Exception in callback of async function: Error: Subscription failed!". It works when I try the subscription without return and Meteor.subscribe.

My code:

Router.route('measurementDetail', { path: '/measurements/:_id/dashboard', waitOn:function(){ return [ Meteor.subscribe("measurementEdit", this.params._id), mysqlSub = new MysqlSubscription('measurementData', this.params._id) ] } });

Why doesn't this work?

sushitommy avatar Jul 20 '15 13:07 sushitommy

HELP

kiyasov avatar May 23 '16 15:05 kiyasov

This work:

waitOn: function() {
	return [Subs1.reactive(), Subs2.reactive(), Subs3.reactive()];
},

jacasanov avatar Aug 13 '18 03:08 jacasanov