Try to search your question here, if you can't find : Ask Any Question Now ?

scrollPositionRestoration failing when href is involved – Angular 7

HomeCategory: stackoverflowscrollPositionRestoration failing when href is involved – Angular 7
Avatarrupesh asked 3 months ago

I am using scrollPositionRestoration() to show always my component from the top of it and it actually works. The problem is when I work in different references on the same component (href) instead of calling routerLink to jump to another component.


<li class="nav-item">
  <a class="nav-link js-scroll-trigger text-warning" href="#ourteam">Our Team</a>
<li class="nav-item">
   <a class="nav-link js-scroll-trigger text-warning" routerLink="blog">Blog</a>


imports: [

    RouterModule.forRoot(routes, { scrollPositionRestoration: "enabled" })
  exports: [RouterModule]

on this case it would work for routerLink but not for href. What happens when I click on ourTeam is that I need to click on it twice (I guess it is just cause in the first time I scroll to the top of the component using scrollPositionRestoration on the router, and in the second time being on the same component I do not need to call to the router so I do not call to scrollPositionRestoration )

1 Answers
Best Answer
AvatarMatthias answered 3 months ago
Your Answer

1 + 12 =

Popular Tags

WP Facebook Auto Publish Powered By :