I have probably tried a gazillion ways and nothing is efficient. My last attempt - which works a little well but with an ugly tradeoff was this:
App.UsersRoute = Em.Route.extend({
model: function() {
return App.User.find({}).then(function(response) {
return response;
});
}
});
the problem with this - which I'd love to know is its making a synchronous call. My HTML/DOM won't finish loading until this returns.
Another thing I'd love to know is if I omit the empty object {} from the find - the promise function actually gets called immediately. I promise!
Now other methods I've tried are the following which all have flaws:
- observing content.lastObject.isLoaded on a controller
- implementing arrayContentDidChange from Ember.ArrayController - obviously this gets triggerd multiple times as the array is getting filled. -
You can read about it here https://github.com/emberjs/data/pull/735 There is a question like yours Ember-data RecordArray isLoaded Status. Also you can try to observe
isUpdating
to be false instead ofisLoading