I was trying to use onerror
. Whenever image is not found in the folder it displays a placeholder. My image path is dynamic and comes from backend. Below is how I used it.
<img class="" src="{{imagePath}}my_image.jpg" onerror="this.src='{{imagePath}}placeholder.jpg';" alt="Image not found">
But this is not working and giving error.