Search code examples
angularangular-config

Using APP_INITIALIZER to load external Angular Configuration from Server


I have a pretty good idea about loading an external config file for an Angular app, but I have the following question: does the APP_INITIALIZER provided loading function get executed on the client side, after the AppModule had been delivered to the browser, or on the server side, before the delivery happens?

And if it happens on the client side, doesn't this entail an extra HTTP call to the config file before the application actually starts?


Solution

  • If you are not using server-side rendering everything Angular related is only executed in the browser, except perhaps things that are executed at build time before you deploy your Angular application to the server, but APP_INITIALIZER is executed in the browser.