9

Fucking four hours wasted.

Bad idea

.subscribe(({ messages }) => {
this.messages = messages;
// Scroll to bottom of the chat content
this.chatcontent.nativeElement.scrollTop = this.chatcontent.nativeElement.scrollHeight;
});

because the dom is not manipulated that fast.

Good Idea:

ngAfterViewChecked(): void {
// Scroll to bottom of the chat content
this.chatcontent.nativeElement.scrollTop = this.chatcontent.nativeElement.scrollHeight;
}

Comments
Add Comment