In this article we will learn about some of the frequently asked TypeScript programming questions in technical like “angular window scroll to top not working” Code Answer’s. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on typescript was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Typescript. Below are some solution about “angular window scroll to top not working” Code Answer’s.
angular scroll to top
xxxxxxxxxx
1
scrollToTop(){
2
window.scroll(0,0);
3
}
scroll to top angular
xxxxxxxxxx
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:
5
export 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
angular window scroll to top not working
xxxxxxxxxx
1
var callback = getByClass(containers[i],