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