I need to be able to pass some data (configuration) from angular app to angular library. The requirement is that the configuration needs to be accessible in the decorator of library's NgModule, so I can import some modules conditionally. For example:
@NgModule({
imports: [
!envService.data.production ? StoreDevtoolsModule.instrument() : [],
]
})
export class LibrarysModule { }
I can't find any documentation on this and there is no clear answer on github in any of the topics I found. Is there any reliable approach for angular 8?
There are couple of similar answer over there on stack overflow, but none of them suits my use case (see: passing environment variables to angular2 library). They all explains how to use forRoot()
in order to pass the configration to any service or component of the library. However, I need the configuration in library module's decorator.
from Passing data from angular app to angular library
No comments:
Post a Comment