[DURACOM-234] Switch to standalone bootstrapping API

This commit is contained in:
Giuseppe Digilio
2024-03-26 20:52:26 +01:00
parent 0c3e9b1535
commit a8c3af097d
10 changed files with 189 additions and 202 deletions

View File

@@ -3,15 +3,17 @@ import 'reflect-metadata';
import 'core-js/es/reflect';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { AppConfig } from './config/app-config.interface';
import { extendEnvironmentWithAppConfig } from './config/config.util';
import { environment } from './environments/environment';
import { BrowserAppModule } from './modules/app/browser-app.module';
import { browserAppConfig } from './modules/app/browser-app.config';
const bootstrap = () => platformBrowserDynamic()
.bootstrapModule(BrowserAppModule, {});
/*const bootstrap = () => platformBrowserDynamic()
.bootstrapModule(BrowserAppModule, {});*/
const bootstrap = () => bootstrapApplication(AppComponent, browserAppConfig);
/**
* We use this to determine have been serven SSR HTML or not.
@@ -33,9 +35,9 @@ const main = () => {
// Configuration must be fetched explicitly
return fetch('assets/config.json')
.then((response) => response.json())
.then((appConfig: AppConfig) => {
.then((config: AppConfig) => {
// extend environment with app config for browser when not prerendered
extendEnvironmentWithAppConfig(environment, appConfig);
extendEnvironmentWithAppConfig(environment, config);
return bootstrap();
});
}