mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Merge pull request #577 from Alfresco/dev-mvitale-546-fix
OnDestroy call unsubscribe
This commit is contained in:
commit
192f629fd1
@ -53,6 +53,9 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private _isDialogMinimized: boolean = false;
|
private _isDialogMinimized: boolean = false;
|
||||||
|
|
||||||
|
private listSubscription: any;
|
||||||
|
private counterSubscription: any;
|
||||||
|
|
||||||
constructor(private cd: ChangeDetectorRef,
|
constructor(private cd: ChangeDetectorRef,
|
||||||
translate: AlfrescoTranslationService,
|
translate: AlfrescoTranslationService,
|
||||||
private _uploaderService: UploadService) {
|
private _uploaderService: UploadService) {
|
||||||
@ -61,7 +64,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this._uploaderService.filesUpload$) {
|
if (this._uploaderService.filesUpload$) {
|
||||||
this._uploaderService.filesUpload$.subscribe((fileList: FileModel[]) => {
|
this.listSubscription = this._uploaderService.filesUpload$.subscribe((fileList: FileModel[]) => {
|
||||||
this.filesUploadingList = fileList;
|
this.filesUploadingList = fileList;
|
||||||
if (this.filesUploadingList.length > 0) {
|
if (this.filesUploadingList.length > 0) {
|
||||||
this.isDialogActive = true;
|
this.isDialogActive = true;
|
||||||
@ -70,7 +73,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this._uploaderService.totalCompleted$) {
|
if (this._uploaderService.totalCompleted$) {
|
||||||
this._uploaderService.totalCompleted$.subscribe((total: number) => {
|
this.counterSubscription = this._uploaderService.totalCompleted$.subscribe((total: number) => {
|
||||||
this.totalCompleted = total;
|
this.totalCompleted = total;
|
||||||
this.cd.detectChanges();
|
this.cd.detectChanges();
|
||||||
});
|
});
|
||||||
@ -92,6 +95,8 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
this.listSubscription.unsubscribe();
|
||||||
|
this.counterSubscription.unsubscribe();
|
||||||
this.cd.detach();
|
this.cd.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user