Reputation: 5239
Using ember: 1.7.0
I'm trying to used different loading templates depending on the route that is being transitioned to in my app. None of my routes are nested (i.e. contained within a resource). I've only been able to get ember to serve up the application loading
template. Is there a way to override this behavior in the case of non-nested routes?
Here's a jsbin illustration the problem:
loading
and top-loading
.top
route. top-loading
template, but instead it triggers the loading
template.http://emberjs.jsbin.com/pamego/1/
Thanks in advance for any assistance!
Upvotes: 1
Views: 84
Reputation: 1555
I'm going to do that thing where I question a premise of your question:
If your routes aren't nested then there should be no harm in treating them as resources. Routes only have special behavior when they are nested (they don't reset their namespace).
Conceptually, changing this route to a resource works. The "loading" state is really an enhancement or a special form of "top". When something has multiple states like this, modeling it as a resource makes sense. With all that preamble, I propose this:
http://jsbin.com/javihuceqo/1/edit?html,js,output
Upvotes: 2
Reputation: 6947
The problem is that your route is only nested one level deep, so the application-level loading substate is active. If you had a Route
that was 2 levels down, "FooBar
", for example, then trying to load the FooBarRoute
model would cause the foo/loading
template to be displayed.
Please see this jsbin for an example.
Upvotes: 2