2
votes

I see that the following template is rendered if loading the model takes a long time:

  <script type="text/x-handlebars" data-template-name="loading">
    <h1>Loading</h1>
  </script>

The Route must be defined:

App.LoadingRoute = Ember.Route.extend({});

But the router needs no configuration for this to be active. I think this is ember-related behavior (although it could also be handlebars-related, but I do not think so).

  • Are there other special template names?
  • Where is this magic documented? (not possible to find it in the Ember documentation)
1

1 Answers

5
votes

As you already noticed the router needs no definition for the LoadingRoute since it's somewhat special. The LoadingRoute will be looked up by ember, and if it's find one it is used for exact the expected behavior.

Have a look at this jsbin for an simulated loading example.

Are there other special template names?

Yes, there is also a special route called FailureRoute which can be used to handle errors globally.

Where is this magic documented? (not possible to find it in the Ember documentation)

As for some documentation on this please see this gist. Some of the changes where introduced not long ago, so documentation is somewhat sparse.

Hope it helps.