I'm making a web chat application with ionic, and I'm having trouble with how many messages I show/load. My code to load the messages from the database is this:
<ion-item *ngFor="let mesage of messages | slice: 0:slice" class="msg">
<ion-row>
<ion-text color="tertiary"><b>{{ mesage.user }}: </b></ion-text>
<ion-text color="secondary"> {{ mesage.text }}</ion-text>
</ion-row>
</ion-item>
With this, I load from the first message on the database to message[slice], and when I load more items, I just augment slice's valor, but what I don't know what to do is to only load, for example, the last 10 messages and then load the new ones when they come