angular模板中使用動態html
阿新 • • 發佈:2020-08-22
<farris-button id="openReport" class="d-none" (click)="farrisDialog.show()">Open Dialog</farris-button> <ng-template #buttonRef> <farris-button (click)="farrisDialog.close()">確定</farris-button> </ng-template> <farris-dialog #farrisDialog [title]="geagag" [buttons]="buttonRef" [width]="640" [height]="480"> <ng-container *ngFor="let item of viewModel.report"> <div class="pl-4" > <pre>{{item.ledgerName}}</pre> <div class="pl-4">{{item.content}}</div> </div> </ng-container></farris-dialog>
現在想插值{{item.content}}中放動態拼接的html 則
<farris-button id="openReport" class="d-none" (click)="farrisDialog.show()">Open Dialog</farris-button> <ng-template #buttonRef> <farris-button (click)="farrisDialog.close()">確定</farris-button> </ng-template> <farris-dialog #farrisDialog [title]="geagag" [buttons]="buttonRef" [width]="640" [height]="480"> <ng-container *ngFor="let item of viewModel.report"> <div class="pl-4" > <pre>{{item.ledgerName}}</pre> <div class="pl-4" [innerHTML]="item.content"></div> </div> </ng-container> </farris-dialog>