mardi 23 décembre 2014

How to get actual array from ember model?

I have a model with a hasMany relationship:



var Bus = DS.Model.extend({
model: DS.attr('string'),
passengers: DS.hasMany('passenger', {async: true})
});


This seems to work, in that I am able to iterate through the passengers in my template.


Now I want to have an action in my controller that will do something with the passengers. It involves some business logic, and I'll need to iterate through the list of passengers.


My problem is that when I get the passengers from the model in the controller, it is not an array, it is some sort of object. How do I get an array from this object?





Aucun commentaire:

Enregistrer un commentaire