ObjectUnsubscribedError: object unsubscribed, when sometime(not every time) entering any value in text box
HTML
<input #gb type="text" pInputText class="ui-widget ui-text"
[(ngModel)]="gb.value" (ngModelChange)="clearFilter(gb.value)" placeholder="Find" />
component.ts
clearFilter(newValue) {
this.infomessage = [];
this.errormessage = [];
this.isDelete = false;
this.isDefaultLoad = false;
if (this.oldFilterText === '' && newValue === '') {
return false;
}
this.oldFilterText = newValue;
if (this._configuration.isNullOrEmptyOrUndefined(newValue)) {
this.sortField = '';
if (!this._configuration.isNullOrEmptyOrUndefined(this.dataTable.sortField)) {
this.sortField = this.dataTable.sortField;
}
this.dataTable.reset();
this.tempFilteredRecords = [];
this.getApprovalTypelist();
this.dataTable.sortField = this.sortField;
this.dataTable.sortMode = 'single';
this.dataTable.sortOrder = this.sortOrder;
}
}
My code working good! but Sometime am getting a error when type in the text box. Also clearFilter
does not fire after getting this error.
error: ObjectUnsubscribedError: object unsubscribed
I have tried this(But I don't know these below links related with my defects or not) below discussions
Angular 2 object unsubscribed error
ObjectUnsubscribedError when trying to prevent subscribing twice
Exception: ObjectUnsubscribedError when working with Observables with RxJS and Angular2
ObjectUnsubscribedError when trying to prevent subscribing twice
But everything does not helps to me. Kindly take me out of this unpredictable defect :(