iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

waitOn issue #1512

Closed KovacicB closed 8 years ago

KovacicB commented 8 years ago

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

chrisbutler commented 8 years ago

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

KovacicB commented 8 years ago
screenshot 2016-02-17 23 53 52

Nope, not working..anything else?