Ember renderTemplate relay model

ember.js

Solution

In the `renderTemplate` method you're telling Ember to render a template inside an outlet but it will just default the controller to the one managing the route. Given it's the controller handling the route it makes sense that it manages all the templates within that route.

Of course you can specify a different controller using:

this.render("test", {
    outlet: "left",
    controller: 'test'
});

it can in turn be a controller you already instantiated (and maybe set its `content`):

var testController = this.controllerFor('test');
testController.set(....)
this.render("test", {
    outlet: "left",
    controller: testController
});

About using the model: You can call `this.modelFor('test')` inside the route and it will return the model of the `test` route (it even knows if it has already been resolved). I usually do this when I need to access the model of one of the parent routes.

I believe it makes sense to access the model of a parent route, but not so much if you're accessing the model of an unrelated route. Why don't you want to `merge` both models?

Problem

Working hard on my Ember app here, and it's going along fine. However, I've run into an issue of unexpected behaviour and I'm not sure regarding the best approach to this problem. The problem is that in a specific route, I want to render another route into another outlet. However, the other route that I render into the other outlet doesn't retain it's own model. If I do this: ``` App.TestRoute = Ember.Route.extend({ model: function() { return { heading: "Test", testContent: "This is test." } } }); App.IndexRoute = Ember.Route.extend({ renderTemplate: function() { this.render("test", { outlet: "left" }); this.render({ outlet: "right" }); }, model: function() { return { heading: "Index", indexContent: "This is index." } } }); ``` ... and access the `IndexRoute`, I would expect the `TestRoute`'s model to be rendered into the `TestRoute`'s template, but only the `IndexRoute`'s model is relayed to both templates. Fiddle here: http://jsfiddle.net/3TtGD/1/ How do I allow Ember to use the default model for a route without having to expressively merge them? It seems tedious. Also, having the same name of some model properties, like `{{heading}}` is desirable, but not necessary. What's the best approach for solving this issue? Thank you for your time. Best regards, dimhoLt

Original source