It's puzzling why this isn't functioning as expected:)
import {Router, RouterConfiguration} from 'aurelia-router';
import { EventAggregator } from 'aurelia-event-aggregator';
import {autoinject} from 'aurelia-framework';
@autoinject
export class App {
router: Router;
ea: EventAggregator;
navEvent: any;
constructor(eventAggregator: EventAggregator) {
this.ea = eventAggregator;
}
configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'Intterra Management';
config.map([
{ route: ['', 'home'], name: 'home', moduleId: 'home', nav: false, title: '' },
{ route: 'logs', name: 'logs', moduleId: 'logs', nav: true, title: 'Logs' }
]);
this.router = router;
}
attached() {
this.navEvent = this.ea.subscribe('router:navigation:complete', response => {
localStorage['state'] = location.hash;
});
}
detached() {
this.navEvent.dispose();
}
...
I have confirmed that the event is triggered during navigation, but the subscribed function does not execute. Any suggestions?