Setup
- I have a lot of lazy loaded modules
- I have a 3rd party module that defines its components/directives
- I need to use 3rd party component in many modules (eager and lazy loaded ones)
- 3rd party module has its config called like
3PModule.forRoot({someConfig: someValue})
I'd like to have a single point in my app where i import 3PModule with the config and use it that way in any of my app modules.
Problems/questions
If i import it only in
AppModule- it doesn't work in my lazy loaded modules. (template error, directive unknown)[This one should be because, in my understanding,
AppModuledoes importSharedModulebut sinceSharedModuleis not the one having particular components/directives in itsdeclarations, thenAppModuledoes not have definitions for those 3rd party components/declarations. Is this correct? UPDATE: actually, this might be because modules are not hierarchical so each module has to importSharedModuleseparately]If i import it only in some
SharedModulethen i'm not sure how to export it with configuration:3PModule.forRoot({someConfig: someValue})
What is the proper solution for this?