I'm working on an Angular 10 project. I have a button in the footer component. I want to make the browser scroll to top page. I've searched how to do it on the internet and found that I can user a window.scroll(0,0); function. But There is nothing happens when I clicked on the button. Below is my template code, <footer> <div> <a class="footer_logo" (click)="scrollToTop()"> <img src="./assets/images/logo.png"/> </a> </div> </footer> And here is my footer.component.ts scrollToTop(){ console.log("scroll to top !"); window.scroll(0, 0); } Please help. Continue reading...