I have a simple @NgModule
the boostrap 2 components :
// Global module for all Angular Component
@NgModule({
declarations: Components, // di
I see two ways to get list of bootstraped components:
1) Using ApplicationRef
platformBrowserDynamic()
.bootstrapModule(MenuModule)
.then((menuModule: NgModuleRef<MenuModule>) => {
const appRef = menuModule.injector.get(ApplicationRef);
const components = appRef.components;
});
2) Using ngDoBootstrap
method on your module:
@NgModule({
declarations: [Components, // directives, components, and pipes owned by this NgModule
imports: [BrowserModule, HttpModule, FormsModule],
providers: Providers,
entryComponents: [Menu, Main]
// bootstrap: [Menu, Main]
})
export class MenuModule {
ngDoBootstrap(appRef: ApplicationRef) {
const compRefMenu = appRef.bootstrap(Menu);
const compRefMain = appRef.bootstrap(Main);
}
}