angular模板中使用动态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">{{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>

 

posted @ 2020-08-22 14:38  wolbo  阅读(688)  评论(0编辑  收藏  举报