如何解决错误:类型“ ListResultDtoOfDashboardCountDto” .ts(2339)上不存在属性“长度”?

时间:2020-08-16 15:39:23

标签: angular6

ngOnInit() {
        this._variableLayoutDocumentService.countAllTrainDocuments().subscribe((result: ListResultDtoOfDashboardCountDto) => {
          if (result) {
            for (let i = 0; i < result.length; i++) {
              this.barChartData[0].data.push(result[i].ProceesedDocumentCount);
              this.barChartData[1].data.push(result[i].UnProceesedDocumentCount);
              this.barChartLabels.push(result[i].DocumentTypeName);
            }
          }
        });
      }

我在上面的代码中遇到一个错误: 属性“ length”在类型“ ListResultDtoOfDashboardCountDto”上不存在。ts(2339)

我正在从我的C#代码中获取DashboardCount DTO:

public class DashboardCountDto : EntityDto<long>
    {
        
        public int Total { get; set; }
        public string DocumentTypeName { get; set; }
        public int ProceesedDocumentCount { get; set; }
        public int UnProceesedDocumentCount { get; set; }
       

    }

0 个答案:

没有答案