I want to access isDisabled variable from audio.onerror function and want to reset the value of isDisabled but unable to set it.
public isDisabled: boolean = false;
private verifyPrompt(url: string): boolean{
let audio = new Audio(this.promptMessageUrl);
this.isDisabled =
audio.load;
audio.onerror = function(e){
this.isDisabled = true;
}
}
Remove thefunction
keyword and use arrow function notation ()=>
.
audio.onerror = (e) => {
this.isDisabled = true;
}