From 30d3d70a8097cd565faf2329592b442146eb2e5c Mon Sep 17 00:00:00 2001 From: Timon Masberg Date: Mon, 19 Feb 2024 12:45:35 +0100 Subject: [PATCH 1/2] fix(spa): environment not loaded in app module --- apps/spa/src/main.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/spa/src/main.ts b/apps/spa/src/main.ts index d0b58277..08a06053 100644 --- a/apps/spa/src/main.ts +++ b/apps/spa/src/main.ts @@ -1,6 +1,5 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; import { DynamicConfig } from './environments/dynamic-config.model'; import { environment } from './environments/environment'; @@ -11,9 +10,9 @@ fetch('./assets/config.json') ...(config as DynamicConfig), ...environment, }); - - platformBrowserDynamic() - .bootstrapModule(AppModule) - // eslint-disable-next-line no-console - .catch((err) => console.error(err)); - }); + }) + // we have to dynamically import the module, so the environment does not get evaluated before the fetch + .then(() => import('./app/app.module')) + .then(({ AppModule }) => platformBrowserDynamic().bootstrapModule(AppModule)) + // eslint-disable-next-line no-console + .catch((err) => console.error(err)); From 15455c46e597fe6a9ae465de1c44d8e15b927985 Mon Sep 17 00:00:00 2001 From: Timon Masberg Date: Mon, 19 Feb 2024 12:46:23 +0100 Subject: [PATCH 2/2] feat(spa): add loading indicator --- apps/spa/src/index.html | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/apps/spa/src/index.html b/apps/spa/src/index.html index 753a8233..4c2702e0 100644 --- a/apps/spa/src/index.html +++ b/apps/spa/src/index.html @@ -23,6 +23,40 @@ - + + + +
+ +
+