Hey all,
after seemingly going through the same steps as I always do in working with Iron Router, Controllers, data contexts, etc., I can’t seem to figure out why I’m lacking reactivity in my template.
Here is my route:
Router.route('/dashboard/:_id', {
name: 'dashboard',
controller: dashboardController,
data: function() {
currentOrgId = this.params._id;
},
});
This is my controller:
dashboardController = RouteController.extend({
layoutTemplate: 'layout',
action: function(){
this.render('dashboard');
},
waitOn: function(){
return [
Meteor.subscribe('myOrgs', Meteor.userId()),
];
}
});
Here is the helper:
Template.dashboard.helpers({
myOrgs: function(){
return Orgs.find();
},
thisOrg: function(){
return Orgs.findOne({_id:currentOrgId}).name;
},
});
And finally, the route call from my “change #mySelect”
Router.go('dashboard', {_id: e.target.value});
When I change the select, I get the correct url, with the updated _id, but the helper data doesn’t change. On a refresh, I get the appropriate data.
Not sure what I’m missing here – hopefully someone can see what I’m missing!
Thanks in advance!