I want to set a base title value for my Aurelia application and then append a value to it based on the route that is active.
My router configuration is:
export class App {
configureRouter(config, router) {
config.title = 'Brandon Taylor | Web Developer | Graphic Designer';
config.map([
. . .
{ route: 'work', name: 'work', moduleId: 'work', nav: true, title: ' | work' },
. . .
]);
this.router = router;
}
}
Aurelia wants to append the title
navigation parameter to the beginning of the config.title
, but I would like it at the end.
I've tried doing an override in the view model:
export class Work {
activate(params, routeConfig, navigationInstruction) {
routeConfig.navModel.router.title += ' | work';
};
}
but this results in:
Brandon Taylor | Web Developer | Graphic Designer | work | work | work ...
on each routing request. What am I doing wrong? or how can I append the route title
attribute to the end of the config.title
instead of the beginning?
activate()
would be called multiple times? If Iconsole.log('activate called');
inside the method itself, and navigate to the route, nav away and nav back, I see multiple log statements. – Brandon