How to set fallback image on source image not found

fallback image
fallback image

Simple snippet for image fallback for normal img tag and for angular image fallback.

Set fallback image for 404 image using onerror handler.

Image fallback for normal img

<img src="" onerror="this.src=''">
<img src="" onerror="this.src='img/default.png'">

angular image fallback

<img ng-src="{{data.url}}" onerror="this.src='img/default.png'">