I have an Aurelia app with a router and nav bar. I need to be able to dynamically show or enable those routes in the nav bar based on the state of the app. I've attempted to use a method like nav: isVisible()
, or show.bind
binding with a custom settings
property in the route config. Neither of these will dynamically update the nav view during navigation. How can I get the nav to update on demand?
1
votes
1 Answers
0
votes
Well, I don't know if this is the right way, but I found that binding to my custom visible
member on the route config settings and updating it on navigation like this works:
this.eventAggregator.subscribe('router:navigation:processing', ()=>{
if (this.session.topic != null)
router.routes.find(r => r.name === 'selectMovie').settings.visible = true;
});
As clean as Aurelia has been so far, however, I'd expect a built in way to do this.