Fix broken image path (#463)
* Fix broken image path * switch to use .endsWith instead of ==
This commit is contained in:
parent
a310e6ee7f
commit
d280e932f9
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue