I read this question and this question. Both handle the variable scope in functions and not in classes where I can not make the that trick. How can I set a class variable in the callback method?
class A{
constructor(){
this.name="";
}
callbackFunction(){
this.name="abc"; //not working, this is undefined
}
loadComponents(){
promise.then(this.callbackFunction);
}
}