I have added current component selector in app.component.ts as per my previous question Angular2, How to get the current active component selector to use it as class globally for css styling
but now i have modified my code to use lazy module functionality, I have only issue of accessing the component selector using the below code
activeSelector: string;
constructor(private resolver: ComponentFactoryResolver) {}
onActivated(component) {
this.activeSelector =
this.resolver.resolveComponentFactory(component.constructor).selector;
}
I am getting the below error:
No component factory found for MyComponent. Did you add it to @NgModule.entryComponents?.
I have tried to add in the entry components and in NgModule even but still don't know how to access it for lazy module.
Does any one know how to achieve it for lazy module. Thank in advance for the help.