I am working on an angular project and I need to figure out a way to automatically scroll to the bottom of the page when the user clicks a button.
I tried doing this with the jQuery function animate() which didn't work for me. I have also tried the below function:
scrollToBottom() {
  let myElement = document.getElementById("myPageId");
  myElement.scrollTop = myElement.scrollHeight;
}
This function only works when I call it from my html page, while I need to use it in my ts file when the user clicks a button.
 
     
     
     
     
     
    