I am having an application which makes use of an independent navigation bar on it’s side. So, the navigation bar allows the user to navigate a set of nested routes independently from the current route. However, as the current route changes I need to tell the sidebar what the current route is as it is possible to navigate from the route’s template as well. Therefore I am using a service which I call from the route’s setupController() method. This works quite well unless the user navigating back within a nested route. For instance we are at (book: 1, page: 2) and the user navigates to (book: 1), this is an issue, as the setupController hook is not called. Same goes for the browsers back button. Is there a good way to make this work reliably?
I would use named outlets for this.
I cover this in my talk here: http://alexspeller.com/embercamp-london-talk-routing/
When a route is exited, the
deactivate method is called on the route, which may be the missing piece you need to cobble the service together There’s also an
activate hook which may be more appropriate than the
setupController one. I’ve been in the same situation you’ve been in before, but never quite got it right, but I didn’t know of those hooks the last time I tried. It would be nice if we could just depend on a property on the router or something, but I haven’t found such a thing.
Yes! This is exactly what I was looking for but couldn’t find the last time I was looking. Maybe it hasn’t been there by then - I don’t know, but this looks like it could really work
Just finally got to watch the video. Great presentation. But I think using named outlets would make everything more complex in my case, as the navigation contains the whole data from various nested routes and I would like to keep it independent from the current route as much as possible