首页 > 解决方案 > 角度类型“未定义”不可分配给类型

问题描述

我不明白这里的问题。我必须使用 temp var,因为它会导致代码的其他部分出现问题。

public orgTemp: any = null;
public orgList!: Array <Organization>;


errors:
this.api.ListOrganizations().then(event => {
  this.orgList = event.items;

works:
this.api.ListOrganizations().then(event => {
  this.orgTemp = event.items;
  this.orgList = this.orgTemp;

标签: angular

解决方案


推荐阅读