When using NgModules, it it possible to run code when that module is initialized, including it in the constructor. For example, here's how the ng-select component suggets it should be configured: https://github.com/ng-select/ng-select?tab=readme-ov-file#step-4-optional-configuration. How can something similar be done in an application that is standalone and does not use NgModules? The only thing that comes to mind is an AppInitializer, but there's one disadvantage: the code will always run when the application is being initialized. With NgModules, it was possible to defer the code to be run only when the module is loaded, if it was a lazy-loaded module. I'm aware that I can still use NgModules, and that might as well be a situation where it makes sense to do so, but I wonder if there is another solution. Continue reading...