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.
APP_INITIALIZE
is used only for Application level. - yurzui{ path: '', component: FileSharingComponent, **resolve: ...** children: [ {path: '', redirectTo: 'cloud-service/internal-storage', pathMatch: 'full'}, {path: 'cloud-service/:cloudServiceID', component: ListOutletComponent, children: childRoutes } ] }
thank you for your advices @yurzui - Roman Koraresolve
suits best to solve that kind of issues :) - Burak Tasci