Define a 404 fallback image in an Angular component

Try to load an image, but if it doesn’t exist instead load another image.

# .html
  alt="Photo of {{ }}"
  (error)="errImage($event, v)"
/>Code language: HTML, XML (xml)
# .ts
errImage(e: any, v: any): void { = this.getAltImage(v);
}Code language: PHP (php)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.