dimanche 18 octobre 2015

Ember.js: #each not listing items in different templates

I am coding the "todomvc" example and now closed in this issue:

I've done the iteration of todos in the templates/todos.hbs

<ul id="todo-list">
  {{#each}}
  <li {{bind-attr class="model.isCompleted:completed isEditing:editing"}}>
    {{#if isEditing}}
      {{edit-todo class="edit" value=model.title focus-out="acceptChanges"
                       insert-newline="acceptChanges"}}
    {{else}}
      {{input type="checkbox" checked=isCompleted class="toggle"}}
      <label {{action "editTodo" on="doubleClick"}}>{{model.title}}</label><button {{action "removeTodo"}} class="destroy"></button>
    {{/if}}
  </li>
  {{/each}}
</ul>

and it works.

but when I'm recfatoring and create a file "templates/todos/index.hbs" called by {{outlet}} it does not show the listed todos.

enter image description here

enter image description here

enter image description here


So, i also tried {{#each todo in model}}, and the todos are shown, but my edit event are not working anymore.

thanks in advance.




Aucun commentaire:

Enregistrer un commentaire