Preserve trailing slash in Angular5
To work with Angular Universal , Copy the main.ts Location strategy code to main.server.ts
const __stripTrailingSlash = (Location as any).stripTrailingSlash;
(Location as any).stripTrailingSlash = function _stripTrailingSlash(url: string): string {
const queryString$ = url.match(/([^?]*)?(.*)/);
if (queryString$[2].length > 0) {
return /[^\/]\/$/.test(queryString$[1]) ? queryString$[1] + '.' + queryString$[2] : __stripTrailingSlash(url);
}
return /[^\/]\/$/.test(url) ? url + '.' : __stripTrailingSlash(url);
};
Credits @gdi2290