Load ember models after view render

Hey guys,

So the Router stops when loading the model untill the promise fulfills. (Asynchronous Routing - Routing - Ember Guides) Since I’m loading 2000+ models, is it possible to transition into the route, render the view and then load the models?

In you route model, you can try to passe a simple model with “beforModel” , and “model” with you 2000+.

Could you transition in the beforeModel hook, and then load the data in the model or afterModel hooks?

All three hooks model, beforeModel and afterModel are waiting for the promise to fullfill. Right now I just know 2 possibilities. Either the hook returns something else than a function (maybe false?), which sounds ugly to me. Or you can load the data in the setupController hook, which sound more correct to me.

It might be necessary to notify the controller that holds those entries with @controllerFor(‘hugeModel’).notifyPropertyChange(‘content’). This way you are sure the view renders, when the data is loaded.

Awesome! thanks a lot, will try this today :smiley: