防止Angular7项目在控制台中出现垃圾邮件/洪水错误

时间:2019-03-25 11:28:26

标签: angular typescript error-handling frontend ngx-admin

我正在基于Angular7建立一个项目。

我从ngx-admin空的starter-kit分支开始:

https://github.com/akveo/ngx-admin/tree/starter-kit

有时候,在开发过程中,我会犯错误,因此控制台应该为此怪我,但只能怪我一次。但是目前,它使浏览器挂起了20秒钟,然后打印了1500多个错误。

外观如何:

我正在使用未定义变量的属性。

所以,我看到了错误:

enter image description here

但是然后我看到另一个错误,重复了很多次。

enter image description here

我还没有找到为此启用的任何cumstom错误处理程序,所以我不知道如何解决此问题。

  protected createPositions(memberPositions?: number[]) {
    return this.fb.group(
      positions.map(position => {
        return this.fb.control(!!~memberPositions.indexOf(position.id));
      }),
      { validator: requireCheckedValidator(1) }
    );
  }

  get formPositions() {
    return this.form.get('positions') as any;
  }

  get formCheckboxes() {
    const arr = [];
    Object.keys(this.formPositions.controls).forEach(key => {
      arr.push(this.formPositions.controls[key]);
    });

    return arr;
  }

enter image description here

0 个答案:

没有答案