About my blog

I write about the technical and non-technical aspects of software development

How it works

Microsoft ASP.NETASP.Net
BlogEngine.NET BlogEngine.NET
Azure DevOpsAzure DevOps

Contact info

 Email
 Contact

Follow me

Prod-20240407.1

Categories

Posts in the 'Angular' category

platformBrowserDynamic with Angular Universal
platformBrowserDynamic with Angular Universal

Using platformBrowserDynamic with Angular Universal is a bit of a hack. All we are doing is providing configuration to the application server module so that it has configuration server-side before platformBrowserDynamic can load it on the client.

Angular platformBrowserDynamic method
Angular platformBrowserDynamic method

Scenarios where configuration will be injected only into services and components work well with the APP_INITIALIZER technique. If however we need to configure an application consisting of multiple modules, with each requiring configuration, even partial configuration, then an alternative is necessary.

Angular Universal with APP_INITIALIZER
Angular Universal with APP_INITIALIZER

The APP_INITIALIZER token in Angular can also be used to delay the bootstrapping of the application for Angular Universal

Angular [Universal] runtime configuration
Angular [Universal] runtime configuration

Although the standard out-of-the-box Angular application makes it easy to create and configure options for your application using 'environment' files, this approach has a few issues