I have a the following in Ember
Route
model: function() {
return this.store.findAll('competency');
}
Controller
calendarItems: Ember.computed('model', function() {
return this.get('model').map(function(competency) {
return {
'name': competency.get('title'),
'start': competency.get('endDate')
};
});
})
Template
{{#each model as |item|}}
{{log calendarItems}}
{{/each}}
{{log calendarItems}}
For some reason unknown to me the {{log calendarItems}} inside the loop displays correctly with all of the store items in the models mapped correctly. But only when the {{log calendarItems}} is not present outside the loop.
When the {{log calendarItems}} is also present outside the loop it causes all 4 log statements to return [] as though the model had nothing to map.
If {{log calendarItems}} is on its own it also returns [].
Am I missing something fundamental about Ember here?
Thanks in advance, Ryan
Aucun commentaire:
Enregistrer un commentaire