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');
|
||||
return false;
|
||||
}
|
||||
|
||||
public removePicture():boolean {
|
||||
removePicture():boolean {
|
||||
this.picture = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
protected _changePicture(file:File):void {
|
||||
_changePicture(file:File):void {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', (event:Event) => {
|
||||
this.picture = (<any> event.target).result;
|
||||
|
|
@ -57,7 +57,7 @@ export class BaPictureUploader {
|
|||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
protected _onUpload(data):void {
|
||||
_onUpload(data):void {
|
||||
if (data['done'] || data['abort'] || data['error']) {
|
||||
this._onUploadCompleted(data);
|
||||
} else {
|
||||
|
|
@ -65,12 +65,12 @@ export class BaPictureUploader {
|
|||
}
|
||||
}
|
||||
|
||||
protected _onUploadCompleted(data):void {
|
||||
_onUploadCompleted(data):void {
|
||||
this.uploadInProgress = false;
|
||||
this.onUploadCompleted.emit(data);
|
||||
}
|
||||
|
||||
protected _canUploadOnServer():boolean {
|
||||
_canUploadOnServer():boolean {
|
||||
return !!this.uploaderOptions['url'];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="picture-group" [ngClass]="{uploading: uploadInProgress}">
|
||||
<div class="picture-wrapper" (click)="bringFileSelector();">
|
||||
<img [src]="picture" *ngIf="picture">
|
||||
<img [src]="defaultPicture" *ngIf="!picture && defaultPicture">
|
||||
<img [src]="defaultPicture" *ngIf="!!!picture && !!defaultPicture">
|
||||
|
||||
<div class="loading" *ngIf="uploadInProgress">
|
||||
<div class="spinner">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue