In angular 8, we could do this to get list of all registered components:
//resolver is ComponentFactoryResolver
const factories = Array.from(this.resolver['_factories'].values());
//selector is used so that it will work in production build also
const factoryClass:any = factories.find((x: any) => x.selector === "SOME SELECTOR");
if(factoryClass && factoryClass.componentType != undefined){
console.log("Component found=>",factoryClass.componentType);
}
In angular 9 (when using Ivy), this.resolver['_factories']
is undefined.
I need list of all components including the module's componenets which is being imported from the current module.
This problem has been asked before in this question: