mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 07:50:12 +01:00
fix(picture uploader): AOT minor fixes
This commit is contained in:
parent
65dcb90f05
commit
54756fca99
2 changed files with 7 additions and 7 deletions
|
|
@ -39,17 +39,17 @@ export class BaPictureUploader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bringFileSelector():boolean {
|
bringFileSelector():boolean {
|
||||||
this.renderer.invokeElementMethod(this._fileUpload.nativeElement, 'click');
|
this.renderer.invokeElementMethod(this._fileUpload.nativeElement, 'click');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public removePicture():boolean {
|
removePicture():boolean {
|
||||||
this.picture = '';
|
this.picture = '';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _changePicture(file:File):void {
|
_changePicture(file:File):void {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.addEventListener('load', (event:Event) => {
|
reader.addEventListener('load', (event:Event) => {
|
||||||
this.picture = (<any> event.target).result;
|
this.picture = (<any> event.target).result;
|
||||||
|
|
@ -57,7 +57,7 @@ export class BaPictureUploader {
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _onUpload(data):void {
|
_onUpload(data):void {
|
||||||
if (data['done'] || data['abort'] || data['error']) {
|
if (data['done'] || data['abort'] || data['error']) {
|
||||||
this._onUploadCompleted(data);
|
this._onUploadCompleted(data);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -65,12 +65,12 @@ export class BaPictureUploader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _onUploadCompleted(data):void {
|
_onUploadCompleted(data):void {
|
||||||
this.uploadInProgress = false;
|
this.uploadInProgress = false;
|
||||||
this.onUploadCompleted.emit(data);
|
this.onUploadCompleted.emit(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _canUploadOnServer():boolean {
|
_canUploadOnServer():boolean {
|
||||||
return !!this.uploaderOptions['url'];
|
return !!this.uploaderOptions['url'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="picture-group" [ngClass]="{uploading: uploadInProgress}">
|
<div class="picture-group" [ngClass]="{uploading: uploadInProgress}">
|
||||||
<div class="picture-wrapper" (click)="bringFileSelector();">
|
<div class="picture-wrapper" (click)="bringFileSelector();">
|
||||||
<img [src]="picture" *ngIf="picture">
|
<img [src]="picture" *ngIf="picture">
|
||||||
<img [src]="defaultPicture" *ngIf="!picture && defaultPicture">
|
<img [src]="defaultPicture" *ngIf="!!!picture && !!defaultPicture">
|
||||||
|
|
||||||
<div class="loading" *ngIf="uploadInProgress">
|
<div class="loading" *ngIf="uploadInProgress">
|
||||||
<div class="spinner">
|
<div class="spinner">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue