From 910fa5ae33943177cb24374fbbddebfd170285b6 Mon Sep 17 00:00:00 2001 From: ziajka Date: Fri, 6 Jul 2018 15:18:24 +0200 Subject: [PATCH] Dynamic routing strategy, fixed for AOT changes --- src/app/app-routing.module.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index cf6fba5a..b0f0711f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -24,17 +24,17 @@ const routes: Routes = [ { path: 'server/:server_id/project/:project_id', component: ProjectMapComponent }, ]; -let routerModule; +// AOT in production requires to have exported symbol +export let extraOptions = null; if (environment.electron) { // angular in electron has problem with base-href and links separated by slashes, because of that // we use simply hashes - routerModule = RouterModule.forRoot(routes, {useHash: true}); -} else { - routerModule = RouterModule.forRoot(routes); + extraOptions = { useHash: true }; } + @NgModule({ - imports: [ routerModule ], + imports: [ RouterModule.forRoot(routes, extraOptions)], exports: [ RouterModule ] }) export class AppRoutingModule {}