jeudi 18 juin 2015

Moving an ArrayController/View to a Component in Ember 1.13

I'm currently in the process of updating my Ember App to use 1.13 and am having an issue translating a particular Ember.View and its associated Ember.ArrayController into an Ember.Component, as per the Deprecation Guide.

After repurposing some code, I now have the following:

app/templates/page.hbs

{{example-component content=posts}} // "posts" being an array of objects

app/templates/components/post-list.hbs

{{#each content key="@index" as |post|}}
    {{post.title}}
{{/each}}

In some cases, the order of the items in the posts array will need to change (via the Ember.SortableMixin), and these changes need to be reflected on screen. When I do this, however, it seems as though content isn't being binded correctly and doesn't update visually (though the order of the posts data is correct in the PageController).

I hope this makes sense. Any help is greatly appreciated!




Aucun commentaire:

Enregistrer un commentaire