I have a class let's suppose A and it has two function AA and BB as follow.
export class A {
constructor(){}
public async AA(X){
return true;
}
public async BB(){
var users=new Users({ // db model
name: 'test'
});
users.save(function(err,data){
if(err){
console.log(err);
}else{
var result = await this.AA(data); // Cannot read property 'AA' of null
}
});
}
}
I am not sure how can i access or make public function AA available inside callback function.
I am getting error: TypeError: Cannot read property 'addRecipient' of null