Using Ember.js v1.2.0, I'm trying to render a sidebar template into a named outlet. The template can possibly be different based on the current route. I'm struggling to come up with the "Ember" way to do this.
Here's the gist of what I have so far:
app/templates/application.hbs
{{outlet sidebar}}
app/routes/application.js
var ApplicationRoute = Ember.Route.extend({
renderTemplate: function(controller, model) {
var sidebar = controller.get('sidebar') || 'application';
this._super();
this.render('sidebar/' + sidebar, {
into: 'application',
outlet: 'sidebar'
});
}
});
app/routes/docs.js
var DocsRoute = Ember.Route.extend({
renderTemplate: function(controller, model) {
this.controllerFor('application').set('sidebar', 'docs');
this.render();
}
});
This doesn't really work, and it doesn't feel very Ember-ish. Help?