Skip to content

Commit

Permalink
Fix broken image path (#463)
Browse files Browse the repository at this point in the history
* Fix broken image path

* switch to use .endsWith instead of ==
  • Loading branch information
jean-the-coder committed Apr 26, 2024
1 parent a310e6e commit d280e93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app/directives/image-fallback.directive.ts
Original file line number Diff line number Diff line change
@@ -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]'
Expand All @@ -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;
}

Expand Down

0 comments on commit d280e93

Please sign in to comment.