无法读取属性'push'undefined IONIC2 / ANGULAR2

时间:2017-09-19 03:15:55

标签: angular ionic-framework ionic2

我不明白为什么会发生这种情况,我正在谷歌等关于这个案例的研究,但没有一篇文章可以帮助我..

希望你们能帮忙..

这是我的代码:

public img : any = [];


public imgs : any = [];

问题:

rcvImg(){
this.socket.on("image", function(info) {
  console.log('triger info image', info);
  // this.ctx = document.getElementById('canvas');
  if (info.image) {
    this.img = new Image();
    this.img.src = 'data:image/jpeg;base64,' + info.buffer;
    console.log('URL Image BASE64', this.img.src);
    console.log('URL fresh', this.img);
    setTimeout(()=>{
      this.imgs.push(this.img.src);
    }, 1000);
  }
});

}

无论如何我在构造上运行了这个函数..

网页浏览始终会注意到该错误 “无法读取属性'推'未定义'

感谢您阅读

0 个答案:

没有答案
相关问题