Angular 2 错误:尝试使用被破坏的视图:DetectChanges 错误:尝试使用被破坏的视图:ViewDestroyedError 处的 detectorChanges

2024-02-02

我正在使用 ng2-toastr 并收到以下错误

https://www.npmjs.com/package/ng2-toastr https://www.npmjs.com/package/ng2-toastr

Attempt to use a destroyed view: detectChanges Error: Attempt to use a destroyed view: detectChanges at ViewDestroyedError

我在按钮单击事件中有这个。


添加这个:

ngOnDestroy() {
    this.helper.toastr.dispose();}

并改变node_modules/ng2-toastr/bundle/toast-manager.js:

ToastsManager.prototype.dispose = function () {
    var _this = this;
    if (_this.container) {
        _this.container.destroy();
        _this.container = null;
    }
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Angular 2 错误:尝试使用被破坏的视图:DetectChanges 错误:尝试使用被破坏的视图:ViewDestroyedError 处的 detectorChanges 的相关文章

随机推荐