Css 如何通过window.open()加载素描图标?
我有一个带有按钮的应用程序,它打开一个新窗口,可以(通过服务)与父窗口通信(例如,在重新打开或从主窗口关闭时保存其位置)。它工作得很好:Css 如何通过window.open()加载素描图标?,css,angular,typescript,primeng,Css,Angular,Typescript,Primeng,我有一个带有按钮的应用程序,它打开一个新窗口,可以(通过服务)与父窗口通信(例如,在重新打开或从主窗口关闭时保存其位置)。它工作得很好: // Dynamically creating component through a Factory const factory = this.componentFactoryResolver.resolveComponentFactory(ChildWindowComponent); const comp: ComponentRef<ChildWin
// Dynamically creating component through a Factory
const factory = this.componentFactoryResolver.resolveComponentFactory(ChildWindowComponent);
const comp: ComponentRef<ChildWindowComponent> =
this.viewContainerRef.createComponent(factory);
// Note: not passing anything as third argument opens a new tab, and we want a new window
this.childWindow = window.open('', 'Child window', windowStyle << not relevant, but defined);
this.childWindow.document.body.appendChild(comp.location.nativeElement);
但是,这不适用于图标。我们的项目正在使用,图标已正确加载到主应用程序中。它们不在子窗口中。我们不能使用,我甚至不认为这能解决我的问题。我试过:
- 使用
@Import
- 通过
导入样式,但是已经完成了angular.json
- 通过组件标题中的
字段导入(通过styles
)stylesUrl
节点\u模块/primeicons/primeicons.css
中
// Clones links, styles and scripts into the header
document.querySelectorAll('link, style, script').forEach(htmlElement => {
this.childWindow.document.head.appendChild(htmlElement.cloneNode(true));
});