0

Inside my Component ts file , I' ve a "connexion" method:

export class MyClass {
  isOpen = false

  openConnection(url) {

    this.socketClient.connect(this.tokenheader, (response) => {
        this.isOpen = true;
        this.getResponse()
      },
      this.errorCallBack
    );
  }

  errorCallBack(error) {
    this.isOpen = false; // CANNOT READ 'isopen' of undefined
    console.log("Connexion failure" + error);
  }
}

This method returns several callbacks for "response" and "error".

As you can see i ve the call of "this.errorCallBack" when error

it's used to print the error message ;

but i ve to set my class variable to false (this.isOpen = false;)

but i get :

CANNOT READ 'isopen' of undefined

Sugesstions ??

Ele
  • 33,468
  • 7
  • 37
  • 75
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148

0 Answers0