Appending a value to the end of the config.title instead of the beginning
I would like to set a default title in the Aurelia config and then append values to the end of it in views, but Aurelia seems to want to append values to the beginning of the config.title value.
I have this question currently open on Stack Overflow: http://stackoverflow.com/questions/32802219/appending-a-value-to-the-aurelia-router-config-title
Solved:
In main.js, override buildTitle:
import {NavigationContext} from 'aurelia-router';
NavigationContext.prototype.standardBuildTitle = NavigationContext.prototype.buildTitle;
function buildTitle(separator=' | ') {
var titleValues = this.standardBuildTitle(separator).split(separator),
routeTitle = titleValues[0],
configTitle = titleValues.slice(1);
configTitle.push(routeTitle);
return configTitle.join(separator);
}
NavigationContext.prototype.buildTitle = buildTitle;
We should make it easier to customize this behavior.
Perhaps a config option to append or prepend the route title?
That sounds reasonable. On Sep 29, 2015 12:43 PM, "Brandon Taylor" [email protected] wrote:
Perhaps a config option to append or pre-pend the route title?
— Reply to this email directly or view it on GitHub https://github.com/aurelia/router/issues/218#issuecomment-144110490.
The NavigationInstruction._buildTitle function has as a separator parameter. From what I can tell only the default value separator = " | " is used.
Please would you consider allowing the separator to be configured as well?