首页 > 解决方案 > 如何在 Firefox 中正确调试 Angular - 错误:“[object Object]”

问题描述

有什么方法可以启用与 Google Chrome 开箱即用的调试 Angular 应用程序相同级别的调试,尤其是避免出现以下错误:

Error: "[object Object]"

我正在使用FF 68.0b2 (64-bit - dev edition)。Chrome 中的相同错误是人类可读的:

core.js:15724 
ERROR Error: Uncaught (in promise): TypeError: 
Cannot read property 'unsubscribe' of undefined
TypeError: Cannot read property 'unsubscribe' of undefined
    at ProfileComponent.push......

我目前正在使用 Angular v7.2.15。

[编辑]

代码示例

ngOnInit() {
  this.authSub = this.authService.isAuthenticated()
      .subscribe((authenticated: boolean) => {...}

  this.profileSub = this.userService.getCurrentUserProfile()
            .subscribe((me) => {...}

}

ngOnDestroy() {
  this.authSub.unsubscribe();
  this.profileSub.unsubscribe();
}

参考:http ://codedam.com/angular-error-error-object-object/

标签: angularfirefox

解决方案


我认为 Angular 有问题defaultErrorLogger(console) 所以我收到这里描述的错误消息 https://stackoverflow.com/a/56440176/6190470


推荐阅读