Javascript ObjectUnsubscribedError:已取消订阅的对象

Javascript ObjectUnsubscribedError:已取消订阅的对象,javascript,html,angular,typescript,observable,Javascript,Html,Angular,Typescript,Observable,对象取消订阅错误:对象取消订阅,有时(不是每次)在文本框中输入任何值时 HTML 我的代码运行良好!但有时我在文本框中键入时出错。另外,获取此错误后,clearFilter不会触发 错误:对象取消订阅错误:对象取消订阅 我在下面的讨论中尝试过这个(但我不知道下面这些链接是否与我的缺陷有关) 但一切对我都没有帮助。请带我走出这个无法预测的缺陷:( 最后我得到了答案,我刚刚使用下面的代码取消订阅了onFilter()事件 this.dataTable.onFilter.unsubscrib

对象取消订阅错误:对象取消订阅,有时(不是每次)在文本框中输入任何值时


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

错误:对象取消订阅错误:对象取消订阅

我在下面的讨论中尝试过这个(但我不知道下面这些链接是否与我的缺陷有关)

但一切对我都没有帮助。请带我走出这个无法预测的缺陷:(


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

this.dataTable.onFilter.unsubscribe();
谢谢你的意见

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;
        }
    }
this.dataTable.onFilter.unsubscribe();