【发布时间】:2018-08-16 08:50:01
【问题描述】:
我使用以下代码检查数组是否为空,然后显示消息,否则显示列表。但它只显示列表正在工作。 “无消息” 未显示。这里有什么问题?
<ion-row *ngFor="let item of globalArray">
<div *ngIf="!globalArray?.length > 0">
<p>No messages</p>
</div>
<div *ngIf="globalArray?.length > 0">
<ion-item>
{{item.message}}
</ion-item>
</div>
</ion-row>
【问题讨论】:
-
试试这个条件
*ngIf = ' globalArray?.length == 0看看
标签: angular typescript ionic3