[英]Why when i scroll top my page and click link which append a form it scroll me down
[英]Perfectly scroll to top. but when i scroll down and click anywhere on page, again scroll moves to the top
這是我的代碼。 呈現頁面時效果很好,但是當我在某處單擊時會變為頂部
ngAfterViewChecked() {
// this.mainPageComponent.rightPanel.nativeElement.scrollTo(0, 0);
this.element.nativeElement.scrollIntoView();
}
每次在angular檢查組件視圖后都會觸發ngAfterViewChecked。
如果希望僅在初始化時觸發此效果,則應使用ngOnInit。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.