Given these templates
<script type="text/x-handlebars">
<h3>Application outlet:</h3>
<div class="outlet">
{{outlet}}
<div>
<h3><code>'base'</code> outlet:</h3>
<div class="outlet base-outlet">
{{outlet 'base'}}
</div>
</script>
<script type="text/x-handlebars" data-template-name="index">
<h1>I am the application index, I should be in the application outlet.</h1>
</script>
<script type="text/x-handlebars" data-template-name="foo">
<p>I am foo, I have my own outlet here:</p>
<h3>Foo Outlet:</h3>
<div class="outlet foo-outlet">
{{outlet}}
</div>
</script>
<script type="text/x-handlebars" data-template-name="foo/index">
<p>I am foo index, I should be inside <code>#foo-outlet</code> (green border)</p>
</script>
And these routes:
App.Router.map(function() {
this.resource('foo', function() {
this.resource('bar');
});
});
App.IndexRoute = Ember.Route.extend({
afterModel: function() {
this.transitionTo('foo.index');
}
});
App.FooRoute = Ember.Route.extend({
renderTemplate: function() {
this.render({into: 'application', outlet: 'base'});
}
});
I would expect the foo/index
template to be rendered inside the {{outlet}}
contained in the foo
template, however it is rendered into the applications outlet, there is a live example here: http://jsbin.com/yecatu/6/edit?html,js,output
Note if I put a call to this._super()
in renderTemplate
I get the foo/index
sort of in the right place, but the foo
template is rendered twice.
Update: What I'm trying to achieve is the following:
- Application has a named outlet, let's say
'sidebar'
- A route can render a wrapper into this sidebar outlet which contains its own (unnamed) outlet
- Then sub routes of that route should render in the outlet within the wrapper.
So in the above example the foo
route should be rendering its wrapper into the 'base'
outlet, then the content of its sub routes (foo/index
in the example) should be rendered within the outlet inside that wrapper (the one with the class foo-outlet
in the example).