angular window scroll to top not working

scrollToTop(){
	window.scroll(0,0);
}

4
4
M Farshi 80 points

                                      var callback = getByClass(containers[i], 

4 (4 Votes)
0
3.88
8
The Count 75 points

                                    //inside the app.component.html add (activate):
<router-outlet  (activate)="onActivate($event)"></router-outlet>

//inside app.component.ts, add inside the class of the component:
export class AppComponent {
 
  onActivate(event) {
    window.scroll(0,0);
    //or document.body.scrollTop = 0;
    //or document.querySelector('body').scrollTo(0,0)
    
}
}

3.88 (8 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
scroll page to top in angualr scroll always to be at top in angular 10 scroll to top of body using angular scroll to top of the angular page section with viewportscroller scrollto to top of the angular page section with viewportscroll how to scroll to top of the page in angular how to get scroll on top in angular how to scroll top in angular scroll to top of page angular how to write scroll top and down in angular 8 angular router scroll to top scroll to top id angular how to scroll to top of the page in angular 9 angular scroll to top component scroll to top angular 12 angular scroll to top with duration angular scroll to top duration angular ts scroll to top angular on click scroll to top scroll an element to a top in angular how to scroll to top of page angular scroll to the top of the page angular scroll top on div in angular angular scroll top oninit angular component change scroll to top how to scroll to top of div in angular 8 scroll to top page angular angular onit scroll to top window.scroll to top angular scroll to top and scroll to bottom angular how to scroll to top of the page in angular 8 angular routing scroll to top scroll top in angular scroll a angular component top angular scroll component to top angular scroll to top when new page angular scroll div to top angular scroll content to top angular scroll to element to top angular scroll to top on new page angular 7 scroll to top button ngx scroll to top move inner scroll to top angular inner scroll to top angular implementing scroll to top in angular angular component scroll to top angular scroll top component angular scroll to top of pge scroll to top button angular 8 after scrolling show go to top in angular angular show to top on scroll how to scroll page to top in angular div scroll to top angular angular scroll top of page angular click scroll to top how to keep scroll top angular 8 how to keep scroll top angular 7 angular window scroll to top angular 11 scroll to top Angular 6 scroll to top on click angular button scroll to top angular scroll to top slowly scroll top angular 11 angular material scroll to top get scroll top in angular angularjs scroll to top of div angularjs scroll to top scroll to top of page angular 9 angular js window scroll to top scroll to top in angular 7 angular scroll to top of div scroll to top angular 9 scroll to top using angular angular route scroll to top angular how to scroll page on top when data updates scroll to top angular angular 8 scroll back to top angular force to scroll to top angular window scroll to top in template angular scroll element to top how to scroll to the top of a div in angular scroll top in angular 7 angular scroll to top of component scroll user to top angular angular scroll to top function scroll to top using angualr Angular scroll to top on click scroll position top in angular 6 Angular 7 scroll to top on click angularjs scroll to top of the page angulars scroll to top of the page forcefully scroll to top angularjs how to scroll to top of paeg angularjs how to scroll to top angularjs angular scroll top html scroll to top angular angular scroll to top oninit angular 8 scroll to top of page how to scroll to top in angular scroll to top in angular material scroll to top angular angular scroll top 0 scroll to top angular 2 angular set scroll position to top angular screen top of page angular scroll to bottom on page navigate body scroll to top in angular 8 how to scroll to top of page on load angular 9 next view scroll angular angular window scroll top scrolling direct to view angular scrolltotop angular location back and scroll to top angular scroll element to top angular scroll to part of page angular scroll to position angular angular window scroll to top not working angular 9 scroll to top of page angular scroll to top of page fix scroll to top angular 9 angular scroll to top of the page angular on page load scroll to top scroll to top component when navigating angular go to top of page angular scrollups when page loads scrolltop) angular scroll to the top angular angular scrolltotop angular scrollup scroll is not on top in angular 8 angular 7 scroll to top how to make the screen to load from top on routing on navigationEnd reset scroll angular8 on reload scroll to top angular 8 scroll to top on route change8 scroll top in angular 9 scroll to top angular 8 angular on click scroll to bottom angular scroll to top on route change angular routing reset to top move scrollbar to top with angular scroll top with angular scroll to top on click angular 6 scroll top angular angular 10 scroll to element angular router scroll to top of page on routerLink click chnage routine scroll top angular scroll to top in angualr always scroll to the top in angular scroll up angular how to move scrollbar to top in angular scrolltop in angular 8 how to scroll 20px from top page in angular how to scroll 20px page in angular scroll to top of component angular scroll to top in angular 9 angular scroll to the top scroll to top typescript scrolltop angular 8 window div scroll position based on url angular scroll to top when page loads angular autoscrool to top of the page in angular angular auto scroll to top typescript scroll to top angular 9 scroll to top window scroll top angular (activate) not scrolling to top angular move scrollbar to top angular onload scroll to top in the list angular 8 angular 6 scroll to top of page angular click jumb to any page angular scroll up go to top typescript page goes on top when clicking angualr how to go to top of page in angular scroll to top of page typescript window scrolltop in angular 10 angular move to top of page angular scroll to top window angular scroll to top window.scrolltop angular window scroll to top angular 6 scroll to top angular
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source