Is there any other event that I can relate to?
Indeed, there is an event that you can listen to, and that didLoad .
I tried App.people.on ('isLoaded'), but isLoaded is always right.
As for isLoaded , there was a lot of confusion here; see here ), confusion arises because the isLoaded flag is isLoaded to true in content when the repository finished loading RecordArray for records, even if it was initially empty because the record was no longer available locally. Then, when the server request is returned, RecordArray will be populated with records received from the backend, and the bindings will begin and your templates will be updated.
As indicated in guides :
A record that is downloaded and clean means that it received information about its attributes and relations with the server, and no changes were made locally on the client.
It has been pointed out above that makes didLoad fire.
For additional events related to the model, you can listen to the model life cycle guide
Now for your setup, you can rewrite your code to something like this:
App.PersonRoute = Ember.Route.extend({ model: function(params) { var name = "Erik"; var promise = Ember.Deferred.create(); App.people = App.Person.find(); App.people.on('didLoad', function() { console.log('Found ' + App.people.get('length')); var person = App.people.findProperty('name', name) promise.resolve(person); }); return promise; } });
Hope this helps.
source share