bug fixed
This commit is contained in:
parent
076fa6931f
commit
a16940b3f2
@ -1,9 +1,7 @@
|
|||||||
import { Component, OnInit, Input, ElementRef } from '@angular/core';
|
import { Component, OnInit, Input, ElementRef } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
|
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
import { NGXLogger } from 'ngx-logger';
|
|
||||||
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
|
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { ucapAnimations } from '../animations';
|
import { ucapAnimations } from '../animations';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -72,7 +70,6 @@ export class ImageComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private elementRef: ElementRef<HTMLElement>,
|
private elementRef: ElementRef<HTMLElement>,
|
||||||
private domSanitizer: DomSanitizer,
|
private domSanitizer: DomSanitizer,
|
||||||
private httpClient: HttpClient,
|
|
||||||
private logger: NGXLogger
|
private logger: NGXLogger
|
||||||
) {
|
) {
|
||||||
this.imageSrc = null;
|
this.imageSrc = null;
|
||||||
@ -96,12 +93,13 @@ export class ImageComponent implements OnInit {
|
|||||||
const imageUrl = `${this.base}${this.path}`;
|
const imageUrl = `${this.base}${this.path}`;
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
image.onload = () => {
|
image.onload = () => {
|
||||||
if ('naturalHeight' in this) {
|
if ('naturalHeight' in image) {
|
||||||
if (image.naturalHeight + image.naturalWidth === 0) {
|
if (image.naturalHeight + image.naturalWidth === 0) {
|
||||||
image.onerror('naturalHeight');
|
image.onerror('naturalHeight');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (image.width + image.height === 0) {
|
}
|
||||||
|
if (image.width + image.height === 0) {
|
||||||
image.onerror('width');
|
image.onerror('width');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user