如何在angular中编译和执行外部库并动态附加到DOM 脚本: 我遇到一种情况,需要使用window.print()打印内容的特定部分 打印时,打印部分内部使用外部库的组件,该部分内部有一个画布元素 在编译所有内容时,使用单击事件打印内容 期望: 在execute print()上,应打印库组件中的二维码并显示 它存在于DOM中,但在连接到DOM后不显示组件 用法:

如何在angular中编译和执行外部库并动态附加到DOM 脚本: 我遇到一种情况,需要使用window.print()打印内容的特定部分 打印时,打印部分内部使用外部库的组件,该部分内部有一个画布元素 在编译所有内容时,使用单击事件打印内容 期望: 在execute print()上,应打印库组件中的二维码并显示 它存在于DOM中,但在连接到DOM后不显示组件 用法:,angular,angular-compiler,Angular,Angular Compiler,HTML创建的代码段 HTML生成的代码段 <div class="thermal-printer"> {{innerHTML}}<--- I can see the external component here <!-- <qrcode [qrdata]='qrCodeString' [errorCorrectionLevel]="'M'"></qrcode> --><--

HTML创建的代码段

HTML生成的代码段


<div class="thermal-printer">
    {{innerHTML}}<--- I can see the external component here
    <!-- <qrcode [qrdata]='qrCodeString' [errorCorrectionLevel]="'M'"></qrcode> --><-- If I uncomment this component, it will display the QR code
    <div id="print_id" class="print-page" [innerHTML]="innerHTML"></div><--- Here, it is not attached to this element.
</div>
<div>
<qrcode _ngcontent-dfg-c836="" ng-reflect-qrdata="Test Code" ng-reflect-errorcorrection-level="M"><div class="qrcode"><canvas height="116" width="116" style="height: 116px; width: 116px;">
</canvas></div></qrcode>
</div>

<rt-image class="ng-star-inserted"><img rtelementselect="" class="enable-border image-wrapper gexfb-cssClass"
id="gexfb" ng-reflect-ctrl-instance="[object Object]" ng-reflect-ctrl-descriptor="[object Object]" ng-reflect-ng-class="gexfbcssClass" src="assets/img/no_image.png" style="width: 150px; height: 150px;"><!--bindings={ "ng-reflect-ng-if": "false" }-->
</rt-image>