If I have a route to a state deep in the application, how do I ensure that the proper controller set up has been done although I'm going to enter the inner state directly?
For example,
- state A
- state a, representRoute: 'a'
- state B
- state b, representRoute: 'a/b'
- state C
- state c, representRoute: 'a/b/c'
- state D
- state d, representRoute: 'a/b/c/d
- state E
As you can see you can route directly to states 'a', 'b', 'c' or 'd', but what you can't see is that normally you would go between these states by selecting an item in a controller, which would then trigger a state transition to the deeper state. The problem then is that when you go directly to state 'd' none of your controllers' selections are set up.
So far I've used enterStateByRoute
in state 'a' to set the selection of the first controller and then had to use enterStateByRoute
in state 'b' to do the selection of the first and second controllers, etc. all the way to enterStateByRoute
in state 'd' to do the selection of each controller all the way along. This is quite wasteful, because I end up repeating the same code in each enterStateByRoute
.
What is the best way to set the controller selection to match the directly routed state?