jeudi 2 juin 2016

peekRecord() is not working but peekAll() is working

My backend always responds with all available data and it took a considerably amount of time. So I'm reloading store periodically and I plan to use peekAll() and peekRecord().

My code is:

model: function() {
  return Ember.RSVP.hash({
    'clusters': this.store.peekAll('cluster'),
    'single': this.store.peekRecord('cluster', 'cluster::My')
});

When code is executed, at first I can see that both of these items do not contain content. After few seconds data are loaded to store and I can see content 'clusters' on template as expected. But 'single' is still completely without content ( does not return nothing in template). But when I have a button with action:

alert(this.store.peekRecord('cluster', 'cluster::My'));

I can see that the record was found. Records are also available via Ember Inspector. What am I doing wrong that only peekAll() works in model for me.




Aucun commentaire:

Enregistrer un commentaire