Fix broken image path (#463)

* Fix broken image path

* switch to use .endsWith instead of ==
This commit is contained in:
Jean Fernandez 2024-04-26 10:48:00 -04:00 committed by GitHub
parent a310e6ee7f
commit d280e932f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import {Directive, ElementRef, HostListener, Input} from '@angular/core';
const DEFAULT_IMAGE_FALLBACK_PATH: string = '/assets/images/no-image.svg';
const DEFAULT_IMAGE_FALLBACK_PATH: string = 'assets/images/no-image.svg';
@Directive({
selector: 'img[imageFallback]'
@ -14,7 +14,7 @@ export class ImageFallbackDirective {
loadFallbackOnError() {
// Check to see if we have already tried to load the fallback image.
// Avoids endless loop if for some reason fallback image is missing. Just accept the broken image.
if (this.path(this.elementRef.nativeElement.src) == this.path(this.fallbackSrc())) {
if (this.path(this.elementRef.nativeElement.src).endsWith(this.path(this.fallbackSrc()))) {
return;
}