Angular2: Show placeholder image if img src is not valid

The best way to handle broken image links is the use the onError event for the <img> tag:

<img  class="thumbnail-image" src="https://stackoverflow.com/questions/36026428/./app/assets/images/{{image.ID}}.jpg"
      onerror="this.src="./app/assets/images/placeholder.jpg";"  alt="..." />

Leave a Comment