Reputation: 5055
I want to set certain flags when image is downloaded. I tried using onload event on image tag and call function. With what I implemented below I am getting error:
Uncaught ReferenceError: imageLoaded is not defined at HTMLImageElement.onload
component.html:
<img onload='imageLoaded()' class='doc-img' [src]='imageUrl'>
component.ts:
ngOnInit()
{
this.getDocumentImage()
}
getDocumentImage()
{
this.imageUrl=
this.domSanitizerService.bypassSecurityTrustResourceUrl(`${API.document}/{documentId}`);
}
imageLoaded(){
alert("image loaded");
}
Need some article reference or help in debugging this.
Thanks!
Upvotes: 0
Views: 2246