I need to return my subscribtion in the waitOn parameter of iron-router after a async function is ready.
It should be work like this:
this.route('myRoute', {
template : 'myTemplate',
path : '/foo/:param',
waitOn : function () {
MyAsyncFunction(function(this.params.param){
var result = 'whatever';
return Meteor.subscribe('MyCollection', result);
});
},
data : function () {
return MyCollection.find().fetch()
}
});
What is the best way to solve this with iron-router ? I am looking for a recommend solution.