`
ngAfterViewInit(): void {
// Resolve FA icon component
const factory = this.factoryComponentResolver.resolveComponentFactory(FaIconComponent);
// i thought the problem is with injector - so i tried to use injector that has all configurations required.. directive is in the same module that has FaModule imported and all icons loaded (icon works when i put it diretcly to html)
const componentRef = this.viewContainer.createComponent(factory, 0, this.injector);
(componentRef.location.nativeElement as HTMLElement).classList.add("clear");
componentRef.instance.icon = ['fas', 'times'];
componentRef.changeDetectorRef.detectChanges();
}
`
Result is empty FA element:
So maybe htere is problem with Fa-icon component implementation (its one time binding there?)
Regular directive code:
` ngAfterViewInit(): void { // Resolve FA icon component const factory = this.factoryComponentResolver.resolveComponentFactory(FaIconComponent); // i thought the problem is with injector - so i tried to use injector that has all configurations required.. directive is in the same module that has FaModule imported and all icons loaded (icon works when i put it diretcly to html) const componentRef = this.viewContainer.createComponent(factory, 0, this.injector); (componentRef.location.nativeElement as HTMLElement).classList.add("clear"); componentRef.instance.icon = ['fas', 'times']; componentRef.changeDetectorRef.detectChanges(); }
`
Result is empty FA element:
So maybe htere is problem with Fa-icon component implementation (its one time binding there?)