showing results for - "scroll to top when routing angular"
Josué
16 Jan 2021
1scrollToTop(){
2	window.scroll(0,0);
3}
Charline
16 Apr 2016
1//inside the app.component.html add (activate):
2<router-outlet  (activate)="onActivate($event)"></router-outlet>
3
4//inside app.component.ts, add inside the class of the component:
5export class AppComponent {
6 
7  onActivate(event) {
8    window.scroll(0,0);
9    //or document.body.scrollTop = 0;
10    //or document.querySelector('body').scrollTo(0,0)
11    
12}
13}
14
Camilo
21 Jan 2019
1import { Component, OnInit } from '@angular/core';
2import { Router, NavigationEnd } from '@angular/router';
3
4@Component({
5    selector: 'my-app',
6    template: '<ng-content></ng-content>',
7})
8export class MyAppComponent implements OnInit {
9    constructor(private router: Router) { }
10
11    ngOnInit() {
12        this.router.events.subscribe((evt) => {
13            if (!(evt instanceof NavigationEnd)) {
14                return;
15            }
16            window.scrollTo(0, 0)
17        });
18    }
19}
queries leading to this page
angular top of screen after navigationscrolltop in angular 8angular universal scrolltopfix scroll to top angular 9angular back link scroll positionscroll to top component when navigatingangular scroll to top oninitangular click jumb to any pagehow to write scroll top and down in angular 8scrolltotop angularhow to scroll to top on route change angularangularjs scroll to topangular get scroll ofset to topangular oninit scroll to topalways scroll to the top in angularangular window scroll to topangular navigate scroll to top 28activate 29 not scrolling to top angularscroll to top angular 6 router changescrollto top of the page angularangulars scroll to top of the pageredirect to top of page on click same link angularangular 6 scroll to top on clickangular scroll to top of pageangular scrolluphow to scroll to top of the page in angularangular scroll to element to tophow to set the page to top when navigating from page to page with angularangular scrolltotopscroll to top of page angular 6how to scroll to top angularjshow to scroll to top of page on load angular 9angular scroll to the topscroll top angularangular on click scroll to topangular router navigate scroll tophow scroll to top angular12link top of page angulardiv scroll position based on url angularangular router navigate scroll to topscroll to top of div angularhow to scroll to top of paeg angularjsscroll to top of page angularinner scroll to top angularangular ngoninit scroll to topangular 9 scroll to top of pageangular 8 scroll to top on route change8angular on click scroll to bottomgo on top in ng afterviewangular scrollto top while chnage routingrouter scroll to top angular on initangular scroll to top on page loadgo back to top of page angularget scroll top in angular angular 8 route change scroll to topangular scroll to top windowscroll in children route angularscroll to top id angular angular typescript scroll to topdiv scroll to top angularrouterlink redirect to bottom of the page in angularangular go to top routehow to redirect to user at bottom of page in angular 7angular scroll to top on navigationmove scrollbar to top angularclick go to top of browser angular 2angularjs scroll to top of the pageauto scroll to top of page angularhow to go to top of page in angularangular button scroll to topscroll to the top of the page angularangular scroll to top programmaticallyhow to scroll to top of div in angular 8ngx scroll to topscroll top angular type scriptscroll based on url angularrouterlink scroll to topangular on page load scroll to toponload scroll to top in the list angular 8scroll below to component on same component angular hrefscroll div to top angular 10scrolltop 29 angularangular 11 scroll to tophow to scroll to top in angularangular scroll to top of componentscroll top angular 11scroll to top on div end angularscroll to top page angularscroll to top angular 2angular scroll to bottomangular move to top of pageangular onload go to toppage goes on top when clicking angualrangular js window scroll to topmove inner scroll to top angularwindow scroll to top angularscroll to top when routing angularangular force page to scroll to topwhen i scroll and then click on router link angular preserve scrolled part to other routehow to get scroll on top in angularscroll to top and scroll to bottom angularscroll user to top angularangular 8 scroll to top to modelhow to scroll up if component load in angular 8switching routes scrolls to bottom of page angularscroll to top of page angular 9angular routerlink top of pagescroll to top angular 9how to scrolltop top of the apge on changing routeangular scrolling topclick on link page not starting from top angular 8angular 10 scroll to elementangular scroll top componentkeep scoll at the top in angular sub pageangular component change scroll to topangular scroll topangular routerlink to top of pagehow to keep scroll top angular 7angular when i click on new page it is taking me to page bottomangular 8 scroll back to topangular scroll to top on clickhow to scroll 20px page in angularscroll to top using angualrangular scroll to topscroll up angularscroll top in angular 9angular scroll to top with durationscroll to top typescriptscroll window to top angularscroll always to be at top in angular 10scroll to a section after routing angularset top of the page after navigation in angularnext page open from middlescroll to top of the page in angular 8how to go to top of page in angular router scroll top in angular 11angular 6 scroll to top of pagescroll to top of element position angular 6 window scroll top in angularjsscroll to top using angularangular scroll top of pagescroll to top in angularscroll is not on top in angular 8angular scroll to top on route change same routehow to make routes to top of the pagescroll to top when page loads angularangular change url top of router outletangular scroll to top of the pageangular 9 scroll to topangular routing reset to topscroll page to top angular 6click on link page not starting from top angularhow to move page to the top in routingaction is completely scrolled to the top angularangular route animation prevent scroll resetangular route changing don 27t scroll window to topangular reset scrollingscrolling direct to view angularscroll to top of body using angularscroll top on div in angularscroll back to top angularangular routing after route scroll on topangular scrollups when page loadsautoscrool to top of the page in angularscroll to top on click angular 6angular scroll to top when new pageangular routing scroll to topforcefully scroll to top angularjshow to scroll to top of page angularangular how to scroll page on topscroll to top in angular 9scroll an element to a top in angularwhen data updates scroll to top angularscroll to top on new route change angular 8angular ts scroll to topangular back to top on route changeangular 9 scroll to top on route changeangular 11 scroll to top on every route clickangular8 on reload scroll to topangular page keep scroll to topscroll page routing angularscroll to top of component angularangular router scroll to topangular 7 scroll to topgoto top when component change in angularthis router navigatebyurl top of the page not workingangular 10 window scroll to topangular component scroll to topscroll to part of page angularangular go up on page changeangular routerlink scroll to topangular routing top of pagescroll to top in angular 7angular scroll to top on same routego to top typescriptscroll to the top angularangular prevent scroll to top befroe route animationscroll top in angularjsangular route change scroll to topangular force to scroll to topangular go to top of pagescroll to top of the page in angularangularjs scroll to top of divangular force scroll to topangular 12 scroll to toppagescroll to other page angularscroll element to top angularrouter link scroll top angular htmlmaterial scroll to top angular angular scroll container to top scroll is not at top in angular when route changehow to go to the top in a router outlet pagescroll to top component angularangular scroll to top slowlyhow to scroll page to top in angular scroll to top on route change angular 7screen scrolls down automatically to url angularangular 7 scroll to top on clickhow to scroll to top of the page in angular 9scroll to position angularscroll to top button angular 8scroll top with angularangular show to top on scrollwindow scrolltop angulartypescript scroll to tophow to scroll to the top automatically in angularon page navigate body scroll to top in angular 8on page change page start from top in angularangular scroll top of elementhow to move scrollbar to top in angularangular 11 scroll to top when change routescroll to top on routing in angularlocation back and scroll to top angularangular window scroll to top in templatescroll to top of the angular page section with viewportscrollerangular onit scroll to topimplementing scroll to top on route change in angularhow to set the scroll position to the top after routing angularscroll to top of page route change angular7how to keep scroll top angular 8angular screen top of pagehow to scroll to the top of a div in angularangular 8 scroll to topangular 7 scroll to top on route changeangular top scrollafter scrolling show go to top in angularscrolltop angular 8 windowangular scroll to top on initscroll top route angularrouting to new page scrolls to bottom angular 9scroll to top of page typescriptangular router scroll topangular start page from top when click on routwangular window scroll topangular 7 scroll to top buttonscroll to top on page changeangular force page to scroll to toangular scroll upangular take user to top of page when component loadsscrollto to top of the angular page section with viewportscrollangular 10 scroll to top on route changescroll to top angular 8on navigationend reset scrollnavigate is not going to top of the pagescroll to top in angualrwindow scrolltop in angular 10scroll to top on router linkangular capture scroll to topscroll top angular on routein angular on route different component scroll is not on topscroll a angular component topscroll page to top in angualrangular scroll content to topscroll top on angular when routes navigated 5cangular 8 scroll to top of pageangular about routing resendthe scroll to the topscroll to top angularangular on route change scroll to tophow to scroll top in angularangular scroll to top when route changeangular scroll to top on route changeangular scroll with typescript oninit pagehow to make the screen to load from top on routingscroll top using angularangular scroll to top componentafter navigation set the page to top position in angularangular scroll to top of pgeangular scroll to top durationrouter change scroll to top angularhow to scroll 20px from top page in angularangular scroll element to topdo not change scroll is on component changeangular navigate by url scroll topangular set scroll position to topchnage routine scroll top angularscroll position top in angular 6router link load page on the topangular route scroll to topnavigate to url and move to top angularlocation back scroll to top angularangular router scroll to top of page on routerlink clickangular auto scroll to topangular click scroll to topscroll top in angular 7angular 2 routing scroll to toppage load on top of the page angularwhy routed page in angular does not open fon topangular page top scroll to positionangular scroll to top of divnext view scroll angularangular window scroll to top not workingangular material scroll to topangular scroll to top on navigatescroll to top angular 12scroll top page link angularmove scrollbar to top with angularwindow scroll to top angular 6angular scroll top oninitangular scroll div to tophow to scroll to top of the page in angular 8angular set page to top after change viewangular scroll component to topangular scroll to top on new pageangular scroll to top functionhow to go to top of page wen page is visited in angularangular scroll to top of page on route changescroll to top for parent route but not child rout angularimplementing scroll to top in angularwindow scroll top angularhtml scroll to top angularscroll top in angularangular scroll top 0forcefully scroll to top angularjs routescroll to top when routing angular