From 308debb82bd7dd0d8efb651248491084c246548d Mon Sep 17 00:00:00 2001 From: Matthew Ross Date: Tue, 2 Jun 2020 11:31:47 -0400 Subject: [PATCH] Actual dynamic base href --- src/app/app.module.ts | 12 +++++++++++- src/index.html | 4 ---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4b8938d..24f72c9 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,6 +17,16 @@ import { FileModule } from './files/file-viewer.module'; import { SettingsModule } from './settings/settings.module'; import { SharedModule } from './shared/shared.module'; +function getBasePath() { + let path = window.location.pathname; + + ['/boards', '/settings', '/dashboard'].forEach(p => { + path = path.replace(p, ''); + }); + + return path; +} + @NgModule({ imports: [ BrowserModule, @@ -39,7 +49,7 @@ import { SharedModule } from './shared/shared.module'; }, { provide: APP_BASE_HREF, - useValue: window['base-href'] + useFactory: getBasePath } ], diff --git a/src/index.html b/src/index.html index 9113165..0c0c8b6 100644 --- a/src/index.html +++ b/src/index.html @@ -21,10 +21,6 @@ TaskBoard - Kanban App - -