Reputation: 11356
When some.route
is waiting for slow-model
, you can have a some.route-loading
loading state to show some kitties while waiting.
In this case it makes sense to have some.route-error
too, so you can show a sad face when the payload breaks things.
However, when I click on a link-to
to some/route
, the location href in the address bar is not updated until the loading completes successfully.
I don't know if this is by design, but I would like to be able to navigate back with the browser history on error.
In other words: Can I have the location href in the address bar update before rather than after the loading state appears?
Upvotes: 1
Views: 32
Reputation: 5955
Short answer: no, you can’t.
Long answer: Ember’s router doesn’t consider a transition to be complete (which is when it updates the url) until you have arrived successfully in the new route. That means if you hit the loading or error substates you haven’t get made the transition. If you want the url to change early, then you may need to override loading behavior on that route and handle it custom or create a loading route of your own where you control things more ...
Upvotes: 4