I'm looking for a way to specify a controller to use with a route parameter.
I've tried:
Router.route('/:sort', {
name: 'feed',
controller: function() {
this.params.sort + 'Controller'
}
});
__
Router.route('/:sort', {
name: 'feed',
lastParam: function() {
return lastParam = location.href.split('/').pop()
},
controller: this.lastParam + 'Controller'
});
But it doesn't seem like this
is available in the controller key and setting it to a function gave this client error: "undefined is not a function". (controller cannot be a function)
You can't, you need to supply a fixed name for the controller.
Your controller, however, could be coded to delegate the functionality to other bits of code as required based on the route.