【发布时间】:2019-09-10 04:26:42
【问题描述】:
我有一个 ionic-firebase 聊天应用程序,我想像 WhatsApp 那样按日期对我的聊天进行分组,所以聊天顶部有一个标签,表示“今天”、“昨天”等。所有消息都有一个时间戳但我需要一种方法来使用它们对消息进行分组。谢谢。
this.chatService.markAsSeen();
this.allMessages = [];
this.allMessages = this.chatService.matchMessages;
})```
``` <ion-list no-lines>
<ion-item
no-lines
*ngFor="let item of allMessages; let i = index"
text-wrap
>
<div class="bubble me" *ngIf="item.sentBy === match.uid">
<h3 class="line-breaker">{{ item.message }}</h3>
<p class="time-me">{{ item.time }}</p>
</div>
<div class="bubble you" *ngIf="item.sentBy != match.uid">
<h3 class="line-breaker">{{ item.message }}</h3>
<p class="time-you">{{ item.time }}</p>
</div>
<div
class="seen"
*ngIf="item[matchUid] == 0 && item.sentBy !== match.uid"
>
Seen
</div>
</ion-item>
</ion-list>```
【问题讨论】:
标签: html firebase ionic-framework