Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anything like APP_INITIALIZER for lazy loaded modules in Angular?

Tags:

angular

I am looking for something that lets me execute code when a certain module is initialized. This module is lazy loaded in my application. The APP_INITIALIZER only works for the app initialization process (once at beginning starting at the main module that is bootstrapped).

I cannot use the constructor of the lazy loaded module since my service returns a Promise and I need the response synchronously for working in this lazy loaded module.


1 Answers

Use a resolver. Resolvers are perfect for what you need.

like image 150
Paul A. Trzyna Avatar answered Dec 08 '25 05:12

Paul A. Trzyna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!