错误TypeError:Object(...)不是函数

时间:2020-08-24 12:40:17

标签: typeerror

我在垫选择标签中出现角材错误。选项标签是服务中的* ngFor列表。我在生产模式下收到此错误,但在开发模式下却没有。

ERROR TypeError: Object(...) is not a function ...

我的package.json:

  "dependencies": {
    "@angular/animations": "^10.0.11",
    "@angular/common": "^10.0.11",
    "@angular/compiler": "^10.0.11",
    "@angular/cdk": "^10.1.3",
    "@angular/core": "^10.0.11",
    "@angular/flex-layout": "^10.0.0-beta.32",
    "@angular/forms": "^10.0.11",
    "@angular/google-maps": "^10.1.3",
    "@angular/localize": "^10.0.11",
    "@angular/material": "^10.1.3",
    "@angular/material-moment-adapter": "^10.1.3",
    "@angular/platform-browser": "^10.0.11",
    "@angular/platform-browser-dynamic": "^10.0.11",
    "@angular/router": "^10.0.11",
    ...
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1000.7",
    "@angular/cdk": "^10.1.3",
    ...

1 个答案:

答案 0 :(得分:0)

我通过以下方法解决了这个问题:

if (isArray(json)) {
      json = json.pop();
    }

使用

if (Array.isArray(json)) {
      json = json.pop();
    }

因为isArray是崩溃的自制类。