Rendering order and loading event


#1

I’m following this example to use the loading event in my route instead of using a LoadingRoute. This works well for my purposes, but the problem is that when the page first loads, nothing renders until the IndexRoute’s model is resolved.

I would expect the ApplicationRoute to render, then wait for the model and then render the rest of the templates once the model is available. This leads to a bit of a strange experience during the first load. For example, I’d like to render the app frame before showing some loading UI.

Is there any way to change this behavior?


#2

Declaring the loading event prevents application.hbs from being rendered when initially entering the application and while in loading substate. You have to explicitely set up a LoadingRoute and manipulate the application context from within e.g. activate()/deactivate(). It might be necessary to explicitely declare your own ApplicationController in order to get early access to it via Route#controllerFor('application').