Skip to content

Commit 87a62e4

Browse files
committed
Fixed on destroy property
1 parent f46652b commit 87a62e4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

eform-client/src/app/modules/eforms/components/eforms-page/eforms-page.component.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, OnInit, ViewChild} from '@angular/core';
1+
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
22
import {Subject} from 'rxjs';
33
import {debounceTime} from 'rxjs/operators';
44
import {ApplicationPages, UserClaimsEnum} from 'src/app/common/enums';
@@ -34,7 +34,7 @@ export class EformsPageComponent implements OnInit, OnDestroy {
3434
eformPermissionsSimpleModel: Array<EformPermissionsSimpleModel> = [];
3535
availableTags: Array<CommonDictionaryModel> = [];
3636

37-
mySubject = new Subject();
37+
searchSubject = new Subject();
3838

3939
get userClaims() { return this.authService.userClaims; }
4040
get userClaimsEnum() { return UserClaimsEnum; }
@@ -51,10 +51,9 @@ export class EformsPageComponent implements OnInit, OnDestroy {
5151
private securityGroupEformsService: SecurityGroupEformsPermissionsService,
5252
private userSettingsService: UserSettingsService
5353
) {
54-
this.mySubject.pipe(
54+
this.searchSubject.pipe(
5555
debounceTime(500)
5656
). subscribe(val => {
57-
debugger;
5857
this.templateRequestModel.nameFilter = val.toString();
5958
this.loadAllTemplates();
6059
});
@@ -65,6 +64,10 @@ export class EformsPageComponent implements OnInit, OnDestroy {
6564
this.getLocalPageSettings();
6665
}
6766

67+
ngOnDestroy() {
68+
this.searchSubject.unsubscribe();
69+
}
70+
6871
getLocalPageSettings() {
6972
this.localPageSettings = this.userSettingsService.getLocalPageSettings
7073
('pagesSettings', ApplicationPages[ApplicationPages.Eforms])
@@ -155,7 +158,7 @@ export class EformsPageComponent implements OnInit, OnDestroy {
155158
}
156159

157160
onLabelInputChanged(label: string) {
158-
this.mySubject.next(label);
161+
this.searchSubject.next(label);
159162
}
160163

161164
sortTable(sort: string) {

0 commit comments

Comments
 (0)