Javascript 导入大量值并将其分配给角度形状时,在可能出现内存不足崩溃(Chrome浏览器)之前暂停

Javascript 导入大量值并将其分配给角度形状时,在可能出现内存不足崩溃(Chrome浏览器)之前暂停,javascript,angular,typescript,angular-material,Javascript,Angular,Typescript,Angular Material,我正在使用角材料步进机,我正在使用这个selectionChange($event)功能,它为我提供了mat stepper水平菜单的索引 <mat-horizontal-stepper #stepper="matHorizontalStepper" linear="false" [selectedIndex]="this.selectedIndex" (selectionChange)="selectionChange($event)"> 在这个函数中,我遍历了值和 如果值

我正在使用角材料步进机,我正在使用这个selectionChange($event)功能,它为我提供了mat stepper水平菜单的索引

<mat-horizontal-stepper #stepper="matHorizontalStepper" linear="false"
[selectedIndex]="this.selectedIndex" 
(selectionChange)="selectionChange($event)">

在这个函数中,我遍历了值和 如果值小于100,则浏览器不会崩溃,但如果值为 超过500次浏览器崩溃有人知道如何解决这个问题吗

selectIndex = 0
public selectionChange($event?: StepperSelectionEvent): void {  
    this.selectedIndex = $event.selectedIndex
    if (this.selectedIndex === 1) {
        for (let i = 0; i < this.forms.value.length; i++) {
            while (!this.forms.value[i]) {
                this.forms.addValue()
            }
            this.forms.setValue(this.forms.value[i])
        }
    }   
}
selectIndex=0
public selectionChange($event?:StepperSelectionEvent):无效{
this.selectedIndex=$event.selectedIndex
if(this.selectedIndex==1){
for(设i=0;i