所以给出这个片段:
<app-print-result
*ngIf="!massPrint"
#printResultComponent
[widthPx]="printSheetWidthPx"
[heightPx]="printSheetHeightPx"
></app-print-result>
<iframe
*ngIf="printing"
#printableIframe
class="print-iframe"
[style.width.px]="printSheetWidthPx"
[style.height.px]="printSheetHeightPx"
[src]="sanitizeUrl(iframeSrc)"
></iframe>
并且知道iframe的src将被路由到在代码片段上表示的同一应用程序的PrintResultComponent。如果片段中显示的组件被评论,iframe将正确加载其内容。
否则,iframe的内容将设置为
<html><head></head><body></body></html>
没有初始化应用程序或在devtools控制台中给出任何错误
有人能帮忙吗?
干杯
解决了,这是iframe的src属性的问题。