我需要有条件地添加一个额外的 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 的情况下重写此块?