为什么当我尝试在 Web 应用程序(Angular 8)中继续活动时,边缘和 chrome 浏览器会出现 "This page isn't responding" 警告

Why "This page isn't responding" warning in edge and chrome browser occures when I try to do continues activities in a web application(Angular8)

Page not responding issue

发生此错误后我无法在该页面中执行任何活动,我需要关闭选项卡并重新打开另一个选项卡

Iam using a code to navigate to an array list (Next and Previous) using array indexing
Eg:
 NextClicked(){
        this.spinner.show('priority');
        let CurrentArray : any;
        this.buttonClicked = true
        this.bindStaff = false;
        this.NextClickCalled =true;
        console.log("======Next Clicked=====")
        let CurrentArrayElement = this.modelProject.ID
        console.log(CurrentArrayElement)
        CurrentArray = JSON.parse(localStorage.getItem('CurrentProjectPageRecords'));
        console.log(CurrentArray);
        let CurrIndex =  CurrentArray.findIndex(x => x.ID === this.modelProject.ID);

CurrIndex = CurrIndex+1

let NextID = CurrentArray[CurrIndex].ID

 this.router.navigate(['/projects/' + NextID +'/edit/'+this.projectType]);

}

Next 是从数组中获取下一个元素,Previous 是导航到上一个。继续使用这会产生问题。如果我点击下一步 5 次并点击上一步,页面会卡在那里并显示上述浏览器警告

PreviousClicked(){
        this.spinner.show('priority');
        let CurrentArray : any;
        this.buttonClicked = true
        this.bindStaff = false;
        this.NextClickCalled =true;
        console.log("======Previous Clicked=====")
        let CurrentArrayElement = this.modelProject.ID
        console.log(CurrentArrayElement)
        CurrentArray = JSON.parse(localStorage.getItem('CurrentProjectPageRecords'));
        console.log(CurrentArray);
        let CurrIndex =  CurrentArray.findIndex(x => x.ID === this.modelProject.ID);

CurrIndex = CurrIndex-1

let NextID = CurrentArray[CurrIndex].ID

 this.router.navigate(['/projects/' + NextID +'/edit/'+this.projectType]);

}

不知道这是确切的问题,但我通过连续这样做 activity 收到了警告

View API's Here

为 angular 启用延迟加载解决了我的问题

谈论 Angular 和 CLI 确保启用延迟加载和延迟加载您的路由,这样随着您的应用程序变得越来越复杂和充满功能,初始负载会保持较小。由于生成的包被散列,它们被正确缓存,这要归功于前面部分的缓存headers。

查看下面的内容link 了解有关延迟加载的更多详细信息

enter link description here