我有一个页面,我接受或拒绝数据 . 接受组件重新加载数据到下一组并滚动到页面顶部 .
我有滚动的问题 . 显然,window.scroll(0,0)在加载数据时触发时不起作用 . 我使用了ngAfterContentChecked(),但是只需按下按钮就可以滚动页面(在对话框中没有确认) . 现在我有类似的东西 .
BTW . 我不能改变路线参数,我已经尝试过document.body ......等等
reload: boolean = false;
contentToReload: number = 6;
public ngAfterContentChecked(): void {
if(this.reload){
this.contentToReload--;
if(this.contentToReload == 0)
{
this.blockUI.stop();
window.scroll(0,0); //for edge
window.scrollTo(0,0); //for chrome
this.contentToReload = 6;
this.reload = false;
}
}
}
public setAsCorrect(): void {
this.dataService.setAsCorrect(this.data)
.subscribe(apiResult => {
if (apiResult.result.isAnyDataLeft) {
this.reload = true;
this.getData();
}
else {
this.RoutingService.navigateTo(null);
}
});
}