iron-meteor/iron-router

waitOn issue

Closed this issue · 2 comments

Hey,

I'm working on my meteor project for quite some time now and I've been trying to avoid manual publish and subscribe calls by using autopublish package but I now see that I can't really use that since I need to wait for data to load before rendering templates. We've already used waitOn in a yet unfinished meteor app we were working on in the beginnning of the last year but it doesn't seem to work in my project.

In routes.js file I have:

RouterLayer.route('/home/:_id', {
    name: 'home',
    template: 'home_index',
    waitOn: WaitForData
});
...
function WaitForData() {
    return [Meteor.subscribe("customers"),
      Meteor.subscribe("diseaseGroups"),
      Meteor.subscribe("diseases"),
      Meteor.subscribe("roles"),
      Meteor.subscribe("symptoms"),
      Meteor.subscribe("users")];
}

but I get the error saying: "Match error: Unknown key in field waitOn". Any ideas?

Thanks in advance

i think your declaration syntax is the issue... can you change it to var WaitForData = function() {} and see if that makes a difference?

screenshot 2016-02-17 23 53 52

Nope, not working..anything else?