I was building a basic Angular application, I have a few components, from my home page when I go to out services page, and scroll down, and go back to home page, the scroll is set to bottom of page.
I would like to set my scroll to top every time i open up a component.
Since I am using angular7 I tried using the option available in router,
{scrollPositionRestoration : 'enabled'}
then
{scrollPositionRestoration : 'top'}
,
but it didn't work on Chrome nor on Chrome mobile or on Edge.
Other than that, I tried to set a listener on router and using
window.scrollTop(0,0)
, that didn't work either, neither did using the document variable.
I just want my scroll bar at top. Its such a naive thing but it has frustrated me now.