Actual dynamic base href

This commit is contained in:
Matthew Ross 2020-06-02 11:31:47 -04:00
parent 0fd7817ff5
commit 308debb82b
2 changed files with 11 additions and 5 deletions

View File

@ -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
}
],

View File

@ -21,10 +21,6 @@
<meta name="theme-color" content="#ffffff">
<title>TaskBoard - Kanban App</title>
<script>
window['base-href'] = window.location.pathname;
</script>
</head>
<body>
<tb-app-component>