小编Gun*_*MDD的帖子

*ngIf check是数组为空然后显示消息

我使用以下代码检查数组是否为空,然后显示消息,否则显示列表.但它只显示列表正在运行."无消息"未显示.这有什么不对?

<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>
Run Code Online (Sandbox Code Playgroud)

typescript ionic3 angular

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

angular ×1

ionic3 ×1

typescript ×1