Angular 角度条件html绑定

Angular 角度条件html绑定,angular,Angular,我需要有条件地添加一个额外的html作为div内容。 现在我是这样做的: 之前: <div *ngFor="let cell of cells" class="cell" [innerHTML]="cell.dataWithHtml" ></div> 之后: <div *ngFor="let cell of cells" class="cell"> <img *ngIf="cell.isSpecial" src="whatever"/&

我需要有条件地添加一个额外的html作为div内容。 现在我是这样做的:

之前:

<div *ngFor="let cell of cells" class="cell"
    [innerHTML]="cell.dataWithHtml"
></div>
之后:

<div *ngFor="let cell of cells" class="cell">
    <img *ngIf="cell.isSpecial" src="whatever"/>
    <div class="this_div_should_not_exist" [innerHTML]="cell.dataWithHtml"></div>
</div>
但这又增加了一个div

如何在不添加额外div的情况下重写此块?

在希望消失/替换的div上使用outerHTML-不能使用ng容器


使用插值怎么样?{{cell.dataWithHtml}}它将转义html字符可能的重复问题它不是关于转义html的问题。这是一个关于向内部html添加额外的条件html的问题,我想我可以尝试使用管道来添加额外的html