Lazy loading module with APP_INITIALIZER

2019-02-18 18:05发布

问题:

We have an application where we are lazy loading modules via router. We need to load a some resources before the app module starts, but we don't want to use resolve on router. That's why we are trying to create some provider factory (APP_INITIALIZER) to load some data from server and then use it in components in that lazy loaded module. So every module will have some different settings like translations and so on...

I created a plunker for showcase. https://embed.plnkr.co/uBK23O5cA7QGwlvmbi73/ If you click on lazy it should wait 10 seconds to load the module but its not happening.

We are using angular 2.0.0 version. Thanks for any advice.