window.scrollTo not working
hieuntp2 opened this issue · comments
Minimal reproduction of the bug with instructions:
As normal, when we call window.scrollTop(0,0)
, browser will scroll to top. Or for simple, when scroll bottom of page, open console and call window.scrollTop(0,0)
, current page will scroll to top.
Expected behavior:
Browser will scroll to expected location.
Other information:
I would be willing to submit a PR to fix this issue:
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x ] No
Hi @hieuntp2 !
This is a browser API, not Angular itself... Which browser did you try ? Also try to remove router config object with scroll behavior and try again ?
@hieuntp2
Try this. It's working
const elmnt = document.getElementById(id); elmnt.scrollIntoView({behavior: 'smooth'});