对angular2中的ngfor和ngif指令嵌套实例讲解

ng2 结构指令不能直接嵌套使用,可使用标签来包裹指令

示例如下

<ul>
<ng-container *ngFor="let item of lists">
<div class="thumb p-date" *ngIf="item.picurl">
<a href="# " rel="external nofollow" ><img src="{{item.picurl}} " alt=" " style="width:79px;height: 70px; "></a>
</div>
</ng-container>
</ul>:

以上这篇对angular2中的ngfor和ngif指令嵌套实例讲解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持来客网。