I have an Ember.js route with a renderTemplate
that allows the controller/template to be set by the model. I'm able to get the new controller to function, but when the inherited methods are called, it throws errors about not having a reference to the model that should have been supplied by the model
method in the route. Here is the route:
App.ActivityRoute = App.GameScreenRoute.extend({
model: function(params) {
var lessons = App.getLessons(),
lessonId = params.lesson_id,
activityId = params.activity_id,
lesson = lessons[lessonId],
activity = lesson ? lesson.activities[activityId] : null;
if(activity) {
return activity.load();
}
else {
return Promise.reject();
}
},
renderTemplate: function(controller, model) {
this.render(model.get("template") || "activity", {
controller: model.get("controller") || "activity"
});
}
});
When model.controller === undefined
, the controller used is ActivityController
and it's supplied with the model returned by the model
method, but if I set model.controller
to another controller, the different controller doesn't have a reference to the model returned by the model
method.
Is there something I'm missing or not understanding? Any help would be greatly appreciated.