I cannot seem to specify custom controller inside of the Route.connectOutlets method.
The idea is I don’t want to create empty controllers for each view, well because I don’t believe that this is the right implementation in the first place.
In short if I take Gordon Hempton’s example and slightly update the code in the router items/item route from
item: Ember.Route.extend({
route: '/:item_id',
connectOutlets: function(router, context) {
var item = router.getPath('itemsController.content').objectAt(context.item_id);
router.get('itemController').set('content', item);
router.get('applicationController').connectOutlet('item');
}
})
to
item: Ember.Route.extend({
route: '/:item_id',
connectOutlets: function (router, context) {
var item = router.getPath('itemsController.content').objectAt(context.item_id);
var applicationController = router.get('applicationController');
applicationController.connectOutlet({
viewClass: router.namespace.ItemView,
context: item,
controller: applicationController
});
}
})
The item selection stops working without any errors.
Did I get something wrong in the code, or scenario with multiple views for controller is just not supported?
UPD:
The ItemView template is as follows:
<script type="text/x-handlebars" data-template-name="item">
<h1>{{title}}</h1>
{{{description}}}
</script>
Have you tried using the relevant item as your controller? This way you avoid creating unused empty controllers and have your item content available to your view.