I have an Angular 9 application. I need to display alternative image if the one specified in src is missing. I don't want use onerror, because it is deprecated.
Here is what I found:
<div *ngFor="let entity of entities">
<div>
<img [src]="entity.imageUrl" (error)="onImageError(entity)" width="70" alt="IMAGE"/>
How can I rewrite entity.imageUrl inside onImageError() ?
I have tried following:
onImageError(entity: IEntity) {
entity.imageUrl = 'some-image.svg'
}
But it says
36:3 error expected call-signature: 'onImageError' to have a typedef (tslint:typedef) @typescript-eslint/tslint/config