Angular v2不支持同一元素上使用多個結構指令。
一種解決方法,使用<ng-container>,
允許為每個結構指令使用單獨元素的元素,但不會將其標記為DOM。
<ng-container *ngIf="show">
<div *ngFor="let thing of stuff">
{{log(thing)}}
<span>{{thing.name}}</span>
</div>
</ng-container>
另外一段示例代碼
<ul> <ng-container *ngFor="let item of lists"> <div class="thumb p-date" *ngIf="item.picurl"> <a href="# "><img src="{{item.picurl}} " alt=" " style="width:79px;height: 70px; "></a> </div> </ng-container> </ul>