Does anyone know of a way to add a trailing slash in Aurelia, on the URLs generated with <a route-href="route: route_name; params.bind: {...}">${link.title}</a>
?
I've tried modifying the navModel
and I've searched for an option in routerConfig
that could do this, but haven't found any.
PS: I'm using HTML5 pushState and have removed the hash.
config.options.pushState = true;
config.options.hashChange = false;
UPDATE
I ended up targeting the router:navigation:complete
event to achieve this. It's an ugly hack in my opinion but if gives me what I need:
this.eventAggregator.subscribe('router:navigation:complete',
if (!/\/$/.test(window.location.pathname)) {
window.history.replaceState({}, document.title, window.location.pathname + '/');
}
});