Contextual / Traversing Properties
It’d be great if Routes and Controllers would have properties to access their relations (parent/child). This way you wouldn’t need to explicitly needs: []
each possible Route/Controller and then try to figure out which one is active. I was thinking something like:
parentRoute == exactly that, direct parent of the current Route
childRoute == direct active child route of the current Route
childRoutes == array of active Routes traversing the entire tree below it
Same goes for Controllers of course, maybe Views too. If unavailable, undefined
would be returned. One question I had, should Routes and Controllers have access to each others relations? Eg: Can a Controller get its parentRoute
? Or would you have to this.route.parentRoute
instead?
This would be useful when needing to communicate between Route Controllers. My use case is a wizard like process to create a new record where the parent route needs to know the validation state of whatever the current sub route is, to activate/deactivate the “Next” button (which is located in the parent template).