The element controller must be an Ember.ObjectController in order to successfully display each element and its associated data. ObjectControllers are used to decorate individual elements in an ArrayController. Use the itemController property in the ArrayController "TodosListController" to declare the item's controller:
itemController: 'todo',
Then, when creating the “todo” controller class definition, as suggested in the reference guide, note that the Ember CLI “generate controller” command will create a standard Ember Controller. Standard controllers and ArrayControllers are a few elements (for example, "TodosController" or "TodosListController"). Thus, TodoController must extend Ember.ObjectController to represent individual elements:
`import Ember from 'ember'` TodoController = Ember.ObjectController.extend actions: editTodo: -> @set 'isEditing', true `export default TodoController`
The standard Ember.Controller element, which is sent with a question, cannot display each of the individual todos correctly when it is passed through the "every" helper, because the model for the standard controller refers to the filtered set of all records, enter "todo" instead of a separate record of one todo .
Ive created JS Bin to illustrate - just switch between using Ember.Controller and using Ember.ObjectController for "TodoController" to see the standard controller is not working.
In addition, this is not the cause of the problem, but just in case it was missed, the attribute of the list class attribute is missing the isEditing: edit attribute:
section#main ul#todo-list each itemController='todo' li class={isCompleted:completed, isEditing:editing} // <-- here if ...
source share