Open page already scrolled at bottom (chat app)


So here is what i did regarding the content automatically scrolls down to bottom when you scroll up.

If you log your scrollToBottom function, you could see that the scrollToBottom function exectues several times on page load and even if you stay idle, it will continue to execute, i suspect it has something to do with two-way binding.

So what i did is this:

scroll = true;
scrollToBottom() {
    if(this.scroll) {
        this.scroll = false;

and it will execute once after page load, what if you want it to automatically scroll again? just set scroll = true again whenever you need it.


Paulo Vitor, este seu chat é código aberto? Quero desenvolver algo parecido.


@DanielRP will reply directly to you


How do i add timestamps inside bubbles?


Continuing the discussion from Open page already scrolled at bottom (chat app):

its always scrolling down can you please help me sir


This helped me accomplish what I wanted. However, I have a PopoverController in the header of my chat. On pressing it, it will cause the whole view to re-render and thus call the method to scroll to the bottom of the panel.

I wish to avoid this since if the user has scrolled up a lot searching for something and he decides to use the popover controller, he will have to do all the scrolling again which is annoying and doesn’t make sense.

Any help to deal with this situation would be appreciated!


Yeah, but it makes the page be always scrolled, but what can i do if i want to check previous messages? The page keeps scrolling the page…