When answering other question I made incorrect statement writing that ApplicationRoute.beforeModel()
hook is ran after every transition. When made aware of this fact I confirmed that the hook is ran only once using barebone Ember app.
Unfortunately, there was nothing I could found in documentation that would explain this behaviour. First paragraph of beforeModel documentation states:
This hook is the first of the route entry validation hooks called when an attempt is made to transition into a route or one of its children.
As for ApplicationRoute
- there is not a lot about it, in action bubbling part of the guide we can find information that action bubbles from controller through route to its parent and it lists ApplicationRoute
as a top parent of routes:
If neither the template's controller nor the currently active route implements a handler, the action will continue to bubble to any parent routes. Ultimately, if an ApplicationRoute is defined, it will have an opportunity to handle the action.
Logically, this should mean, that every transition should run ApplicationRoute
hook which is in contrary to what actually happens.
So the question is:
Why ApplicationRoute
doesn't answer to transition events and what are the other differences from defined Routes?
Aucun commentaire:
Enregistrer un commentaire