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 listSubscription: any;
|
||||
private counterSubscription: any;
|
||||
|
||||
constructor(private cd: ChangeDetectorRef,
|
||||
translate: AlfrescoTranslationService,
|
||||
private _uploaderService: UploadService) {
|
||||
@ -61,7 +64,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
if (this._uploaderService.filesUpload$) {
|
||||
this._uploaderService.filesUpload$.subscribe((fileList: FileModel[]) => {
|
||||
this.listSubscription = this._uploaderService.filesUpload$.subscribe((fileList: FileModel[]) => {
|
||||
this.filesUploadingList = fileList;
|
||||
if (this.filesUploadingList.length > 0) {
|
||||
this.isDialogActive = true;
|
||||
@ -70,7 +73,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
if (this._uploaderService.totalCompleted$) {
|
||||
this._uploaderService.totalCompleted$.subscribe((total: number) => {
|
||||
this.counterSubscription = this._uploaderService.totalCompleted$.subscribe((total: number) => {
|
||||
this.totalCompleted = total;
|
||||
this.cd.detectChanges();
|
||||
});
|
||||
@ -92,6 +95,8 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.listSubscription.unsubscribe();
|
||||
this.counterSubscription.unsubscribe();
|
||||
this.cd.detach();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user