gpt4 book ai didi

javascript - 对象取消订阅错误 : object unsubscribed

转载 作者:行者123 更新时间:2023-11-30 15:00:11 25 4
gpt4 key购买 nike

ObjectUnsubscribedError: object unsubscribed,有时(不是每次)在文本框中输入任何值


HTML

<input #gb type="text" pInputText class="ui-widget ui-text"
[(ngModel)]="gb.value" (ngModelChange)="clearFilter(gb.value)" placeholder="Find" />

组件.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;
}
}

我的代码运行良好!但有时在文本框中键入时会出错。此外 clearFilter 在收到此错误后不会触发。

错误:ObjectUnsubscribedError:对象取消订阅

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 :(

最佳答案

最后我得到了答案,我刚刚使用下面的代码取消订阅了 onFilter() 事件

this.dataTable.onFilter.unsubscribe();

感谢您的意见!

关于javascript - 对象取消订阅错误 : object unsubscribed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46661058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com