I'm currently developing an Ionic chat application and I need the content to automatically scroll down when the user clicks on the send text button. You can see a visual representation of this in the images linked below.
https://i.stack.imgur.com/gwRWe.png https://i.stack.imgur.com/cPigw.png
Below is the code snippet I am using:
<ion-content scrollDownOnLoad="true" id="chat-window" class="bg" no-padding>
<ion-list>
<ion-item text-wrap class="message" *ngFor="let chat of chats" no-lines>
<div [class]="chat.sent_by == loggedInUserKey ? 'messageRight' : 'messageLeft'">
<p class="text">{{chat.message}}</p>
<p [class]="chat.sent_by == loggedInUserKey ? 'datetimeRight' : 'datetimeLeft'">
<span *ngIf='chat.display_date'>{{chat.date}}</span>
<span>{{chat.time}}</span>
<span *ngIf='chat.seen' [class]="chat.sent_by == loggedInUserKey ? 'displayseen' : 'hideseen'">seen</span>
</p>
</div>
</ion-item>
</ion-list>
</ion-content>