mercredi 12 octobre 2016

Ember Data Accessing Array with forEach()

I'm having an issue with upgrading ember-data form 0.X to 1.0.0-beta12. My ember.js version is 1.7.1. In my controller I have a method contentChanged(): which loops through my model:

this.get('model').forEach(function(comment) {
    mutableComments.pushObject(comment);
});

Since upgrading ember-data the structure for this.get('model'); has changed so forEach() isn't finding my array.

Before Update: Before

After Update:

After

The content originally is an array[20] but now it is a class which has a content property array[20]. I need to iterate through these items but the current code does not work.

I have tried. this.get('model').toArray()but this returned an empty array. How do I access the content array?




Aucun commentaire:

Enregistrer un commentaire