0

i don't understand why this happen, i was research on google and etc about this case, but no one article can help me..

hope you guys want to help ..

here's my code :

public img : any = [];


public imgs : any = [];

the problem :

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);
  }
});

}

I triger the function on construct anyway..

web browse always notice that error on "cannot read propert 'push' undefined"

thank you for reading

Saravanan Sachi
  • 2,572
  • 5
  • 33
  • 42

0 Answers0