单击关闭通知时出现此错误。它似乎是随机发生的。
zone.js:196未捕获的错误:ViewDestroyedError:尝试使用销毁的视图:detectChanges在viewDestroyedError(core.js:9540)在Object.debugUpdateDirectives [作为updateDirectives](core.js:14336)在checkAndUpdateView(core.js:13508)在callWithDebugContext(core.js:14740)在Object.debugCheckAndUpdateView [作为checkAndUpdateView](core.js:14277)在ViewRef_.webpackJsonp ../ node_modules/@angular/core/esm5/core.js.ViewRef_.detectChanges(core.js:11300)在angular2-notifications.umd.js:531在ZoneDelegate.webpackJsonp ../ node_modules / zone.js / dist / zone.js.ZoneDelegate.invoke(zone.js:392)在Object.onInvoke(core.js:4629)在ZoneDelegate.webpackJsonp ../ node_modules / zone.js / dist / zone.js.ZoneDelegate.invoke(zone.js:391)
此错误在我的应用程序中多次击中(appx 1667次),因为它执行更改检测生命周期挂钩。
[如果有人有解决此问题的想法,请帮助我解决这个问题。
您可以尝试以下方法:
if (!this.changeDetectorRef['destroyed']) {
this.changeDetectorRef.detectChanges();
}