Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用ionic按日期分组聊天_Html_Firebase_Ionic Framework - Fatal编程技术网

Html 使用ionic按日期分组聊天

Html 使用ionic按日期分组聊天,html,firebase,ionic-framework,Html,Firebase,Ionic Framework,我有一个ionic firebase聊天应用程序,我想像WhatsApp那样按日期对聊天进行分组,因此在聊天顶部有一个标记“今天”、“昨天”等。所有消息都有时间戳,但我需要一种方法来使用它们对消息进行分组。谢谢 this.chatService.markAsSeen(); this.allMessages = []; this.allMessages = this.chatService.matchMessages; })``` ``` <ion-

我有一个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>```
this.chatService.markAsSeen();
this.allMessages=[];
this.allMessages=this.chatService.matchMessages;
})```
```   
{{item.message}}

{{item.time}

{{item.message}}

{{item.time}

看到 ```
我们的聊天应用程序中也有同样的功能。对于HTML,请将以下内容放入您的ion项中:

  <ion-row *ngIf="isDifferentDay(index)">
      <ion-badge>{{getMessageDate(index)}}</ion-badge>
    </ion-row>

不客气:)

我们的聊天应用程序中也有同样的功能。对于HTML,请将以下内容放入您的ion项中:

  <ion-row *ngIf="isDifferentDay(index)">
      <ion-badge>{{getMessageDate(index)}}</ion-badge>
    </ion-row>

不客气:)

非常感谢,@wcjord。这正是我所需要的:-非常感谢,@wcjord。这正是我所需要的:-D