I've got a module which I need to use in two places. One inside an Angular application and another as a custom element on its own for use in other places where we are dropping into legacy systems.
The issue arises due to AngularElements requiring the BrowserModule
if it is a root component.
Is there a way to conditionally import this based on whether it is being called as a custom element or not?
I also tried to export as multiple modules using the forRoot
and forChild
approach. With a shared module like so:
@NgModule()
export class SharedModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: RootModule,
providers
}
}
static forChild(): ModuleWithProviders {
return {
ngModule: ChildModule,
providers
}
}
}
Unfortunately, this throws errors as the components are then being imported twice.