Here is my code. Works fine when renders the page but changes to top when i click down somwhere
ngAfterViewChecked() {
// this.mainPageComponent.rightPanel.nativeElement.scrollTo(0, 0);
this.element.nativeElement.scrollIntoView();
}
ngAfterViewChecked is triggered every time after angular has check the view of your component.
You should use ngOnInit if you want this effect to be trigger only at initialisation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.