If an error occurs while loading or rendering an image - (Simple and Useful Solution)

If an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event handler will get called. This can happen in a number of situations, including:

in this case you can call a default image like no-image.png or etc.

<img  onerror="if (this.src != './images/no-image.png') this.src = './images/no-image.png';" width="128" height="128"  dmx-bind:src="scUserDetail.data.query1.profile_photo">

it was simple but useful for me. I hope it works for you.

Community Page
Last updated: