简体   繁体   English

离子性:未捕获(承诺):TypeError:无法读取未定义的属性“ length”

[英]Ionic: Uncaught (in promise): TypeError: Cannot read property ‘length’ of undefined

This is my typescript code 这是我的打字稿代码

export class FailedPage {

  failedjobs: Array<any> = [];

  constructor(public navCtrl: NavController, 
              public navParams: NavParams, public jobfailList: JobActionsProvider) {
  }

  ionViewDidLoad() {
    console.log('FailedPage');
    // getting jobs from job-actions file and displaying
    this.jobfailList.getfailedjobList().then((data) => {
      console.log('displaying failed job list');
      for (let values of data) {
        this.failedjobs.push(values);
      }
    });
  }

}

I'm facing error as 我面临错误

Uncaught (in promise): TypeError: Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at failed.ts:24 未捕获(承诺):TypeError:无法读取未定义的属性“长度” TypeError:无法在failed.ts:24读取未定义的属性“长度”

Here 24 line is for (let values of data) How can I fix this? 这里有24行for (let values of data)如何解决此问题?

api的响应可以是data.data,具体取决于您的后端

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获(承诺):类型错误:无法读取 ionic 2 应用程序中未定义的属性“应用” - Uncaught (in promise): TypeError: Cannot read property 'apply' of undefined in ionic 2 app 未捕获(承诺):类型错误:无法读取 ionic3 中未定义的属性“调用” - Uncaught (in promise): TypeError: Cannot read property 'call' of undefined in ionic3 离子 - 未捕获(承诺):TypeError:无法读取未定义的属性'then' - Ionic - Uncaught (in promise): TypeError: Cannot read property 'then' of undefined “错误:未捕获(在承诺中):TypeError:无法读取未定义的属性”长度“ - “Error: Uncaught (in promise): TypeError: Cannot read property 'length' of undefined” 未捕获(承诺):类型错误:无法读取未定义的属性“长度” - Uncaught (in promise): TypeError: Cannot read property 'length' of undefined 业力 | 离子 | 未捕获的错误:未捕获的错误:未捕获(承诺中):TypeError:无法读取未定义的属性“getToken” - Karma | Ionic | Uncaught Error: Uncaught Error: Uncaught (in promise): TypeError: Cannot read property 'getToken' of undefined Ionic 4:尝试上传自拍图像时,错误:未捕获(承诺):TypeError:无法读取未定义的属性“订阅” - Ionic 4: when trying to upload selfie image, Error: Uncaught (in promise): TypeError: Cannot read property 'subscribe' of undefined IONIC 4 + Angular7:错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ then” - IONIC 4 + Angular7: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined ionic angular:错误错误:未捕获(承诺中):TypeError:无法读取未定义的属性“um” - ionic angular : ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'um' of undefined 错误错误:未捕获(承诺):TypeError:无法读取Angular 7和rxjx中未定义的属性“ length” - ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'length' of undefined in Angular 7 and rxjx
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM