I have 2 options for scrolling to the top of the page. First,
router.events.subscribe((evt) => {
if (evt instanceof NavigationEnd) {
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
}
});
and the second option is available from Angular 6 is,
RouterModule.forRoot(AppRoutes, {
scrollPositionRestoration: "enabled"
})
When I change my route, Page is moving to top which is working as expected. I have tab section at almost bottom of the page using sub route. When the sub route is triggered, the page is moving to the top of the page instead of remaining in the tab section.
So I need to disable the scroll to top functionality on the sub route. Is there any way to do it?
Any help/idea is appreciated.