I am struggling to replace the name key with a value passed in via a parameter this.params.sortby
in the code below. Any help would be appreciated.
For example, if:
this.params.sortby=location
I would like the following:
Template.MyTemplate.helpers({
data: function () {
return MyCollection.find({},{sort:{name: 1 }});
}
});
To be changed to this:
Template.MyTemplate.helpers({
data: function () {
return MyCollection.find({},{sort:{location: 1 }});
}
});