Angular 2: remove CSS from dynamically generated component on destruction
How to remove all CSS classes that were added to the DOM when destroying a dynamically created component.
Create component (which adds CSS component classes to the DOM):
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component)
const componentRef = componentFactory.create(this.injector)
Destroy component
componentRef.destory()
// I need the CSS Classes which were added to the DOM to be destroyed as well
I cannot manually remove them because I have no idea what CSS classes are; so I need to remove all CSS classes associated with creating this component.
+3
source to share
No one has answered this question yet
Check out similar questions: