Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度调试上下文错误无法读取属性ngDebugContext_Angular_Angular Cli_Ecmascript 5_Zone_Zonejs - Fatal编程技术网

Angular 角度调试上下文错误无法读取属性ngDebugContext

Angular 角度调试上下文错误无法读取属性ngDebugContext,angular,angular-cli,ecmascript-5,zone,zonejs,Angular,Angular Cli,Ecmascript 5,Zone,Zonejs,我将angular的版本从2更新为4,现在我在执行服务时遇到以下异常: ERROR TypeError: Cannot read property 'ngDebugContext' of undefined at getDebugContext (core.es5.js:994) at isViewDebugError (core.es5.js:8451) at callWithDebugContext (core.es5.js:13474) at Object.debugCheckAndUpd

我将angular的版本从2更新为4,现在我在执行服务时遇到以下异常:

ERROR TypeError: Cannot read property 'ngDebugContext' of undefined
at getDebugContext (core.es5.js:994)
at isViewDebugError (core.es5.js:8451)
at callWithDebugContext (core.es5.js:13474)
at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.es5.js:13007)
at ViewRef_.detectChanges (core.es5.js:10174)
at core.es5.js:4812
at Array.forEach (<anonymous>)
at ApplicationRef_.tick (core.es5.js:4812)
at core.es5.js:4684
at ZoneDelegate.invoke (zone.js:392)
错误类型错误:无法读取未定义的属性“ngDebugContext”
在getDebugContext(core.es5.js:994)
在isViewDebugError(core.es5.js:8451)时
在callWithDebugContext(core.es5.js:13474)
在Object.debugCheckAndUpdateView[作为checkAndUpdateView](core.es5.js:13007)
在ViewRef_u2;.detectChanges(core.es5.js:10174)
在core.es5.js:4812
在Array.forEach()处
在ApplicationRef.tick(core.es5.js:4812)
在core.es5.js:4684
在ZoneDelegate.invoke(zone.js:392)

此错误已被注入。当我从热观测变为冷观测时。

我在这篇文章中找到了答案。结果是我没有正确返回角度上的可观测值


我有一段时间也遇到了同样的问题,原因是有一些函数返回
throw
,调用没有使用
try-catch
处理


这篇文章可能会有帮助

你找到这个错误的原因了吗?我试图给一个变量分配一个没有返回值的函数,这个函数是可观察的对象,这就是为什么没有调试上下文,我在这里给出的答案中正确的是使用可观察对象。