I have an Angular 7 app in which I am displaying a div
background image. But sometimes link is broken.
My image is bound in my HTML like this
<div [ngStyle]="{'background-image': 'url(' + row?.coverUrl + ')', 'background-size': 'cover', 'background-position' : 'center'}" class="img-area cursor-pointer" (click)="navigateToCOmpany(row)" *ngIf="row.coverUrl !== ''">
</div>
The problem is that sometimes row?.coverUrl
is broken link. So how can I detect that link is broken so that I can bind a default image?