Usually, if your controller represents a list of elements, you should use Ember.ArrayController , and if the controller represents a single element, you should use Ember.ObjectController . Something like the following:
MyApp.ContactsController = Ember.ArrayController.extend({ content: [], selectedContact: null }); MyApp.SelectedContactController = Ember.ObjectController.extend({ contentBinding: 'contactsController.selectedContact', contactsController: null });
Then in your Ember.Router (if you use them), you must connect them inside the connectOutlets function:
connectOutlets: function(router) { router.get('selectedContactController').connectControllers('contacts'); }
Edit: I have never used Ember.Controller . If you look at the source code, it seems that you can use it if you create a custom controller that does not fit into the other two controllers.
Joachim H. Skeie
source share