Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何通过window.open()加载素描图标?_Css_Angular_Typescript_Primeng - Fatal编程技术网

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
到目前为止,一切都没起作用。是否有一种解决方案可以将自定义图标(如涂底漆或材质图标)加载到“我的孩子”窗口中?角度版本为8,图标似乎位于
节点\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));
});