How can a Controller.extend({}) set a variable to be sent though Meteor.subscribe(); used in mongodb query. This can be done by creating whole new controller and putting a static variable in the subscribe function. ex Meteor.subscribe('collection', this.findOptions(),static variable); The problem is that creates a lot of redundant code. Where as setting the variable in the Controller.extend({}) would not.

1

There are 1 answers

0
Michel Floyd On BEST ANSWER

If you define a waitOn function that gathers the subscription(s) then you could do it there. I have some patterns like that in my app. For example a route used for a campaign landing page:

Router.route('/c/:token',{ // This route takes a token parameter
  name: 'campaign',
  controller: 'anonymousController',
  layoutTemplate: 'layout',
  waitOn: function(){
    return Meteor.subscribe('campaign', this.params.token);
  }
});