Solution 1 :

Use window.onload = function() {window.scrollTo(0,document.body.scrollHeight);}.

Hope it helped!

Problem :

I have a page that represents a chat in my Angular-Ionic project. When the user opens the chat, I would like the view to already be scrolled all the way down to the latest message.

I have tried using ionContent.scrollToBottom(0) in a setTimeout (since the content doesn’t load right away) but it’s pretty awkward: it very briefly shows the top of the messages and then teleports to the bottom, making it look super ugly.

I am using Angular 10 and Ionic 5.

Does anyone have a better solution?


Comment posted by

This might help:

Comment posted by 1x2x3x4x

I’d still use Ionic’s scrollToBottom and show a loader if the pause bothers you.