I am trying to loop over some objects in Ember in a controller, and return an array of their name attributes. I am however confused with what Ember is returning from the findAll function.
In a controller, I have the following function -
possibleGenres: function() {
var genres = this.store.findAll('genre');
var genreNames = genres.map(function(item, index, enumerable){
return item.get('name');
});
return genreNames;
}.property(),
Logging genres.get('length') gives me 0.
I have proven that there are genres available in the findAll function, as when returning the returned genres from just the findAll function, they are displayed in the template.
Am I misunderstanding something crucial about Ember controllers here?
As ever, any help is much appreciated.
Aucun commentaire:
Enregistrer un commentaire