Is there a way to extend the data
option when using IronRouter and the RouteController
, It seems like it gets overridden when I inherit from a super controller, the child controller doesn't extend the defined data
properties. I have had similiar issues with the yieldTemplates
option on a route and used a workaround (underscore _extends) but it didn't work in this case:
ApplicationController = RouteController.extend({
data: function(){
return {
user: Meteor.user()
}
}
});
ChildController = ApplicationController.extend({
data: function(){
return {
// I expect to inherit Meteor.User ?????
someData: {}
}
}
});
EDIT:
After using underscore
and the extend
function to inherit the prototype function, I am still unable to inherit in route
definition's that use the ChildController
this.route('someRoute', {
template: 'task_template',
//tasks is not available on the template
data: function () {
var base = ChildController.data.call(this);
console.log(base);
return _.extend(base, {
tasks: Tasks.find({state: 'Open'})
});
});