Angular 2-TypeError:无法读取未定义的属性"apply" [英] Angular 2 - TypeError: Cannot read property 'apply' of undefined
问题描述
我正在开发一个非常简单的Angular 2应用程序,它只有一个组件,一个服务和一个接口,但是遇到了这个错误,经过几个小时的调查,我仍然找不到答案.
I'm developing a very simple Angular 2 application with only one component, one service and one interface but I came across this error and after a few hours of investigating I still can't find an answer.
Uncaught TypeError: Cannot read property 'apply' of undefined
at XMLHttpRequest.desc.get [as ontimeout] (zone.js:1265)
at XHRLocalObject.AbstractXHRObject._cleanup (abstract-xhr.js:149)
at XMLHttpRequest.xhr.onreadystatechange (abstract-xhr.js:125)
at XMLHttpRequest.wrapFn (zone.js:1230)
at ZoneDelegate.invokeTask (zone.js:398)
at Zone.runTask (zone.js:165)
at XMLHttpRequest.ZoneTask.invoke (zone.js:460)
我真的不明白为什么错误会一直出现,错误出现后应用程序仍然可以运行,但是令人沮丧.
I can't really understand why the error is keeps appearing, the application is still functional after the mistake appears but it's frustrating.
有什么想法吗?
推荐答案
我遇到了同样的问题,我解决了降级到zone.js@0.8.5的问题,问题消失了.在您的项目文件夹中运行以下命令:
Hi I had the same problem and I solve this downgrading to zone.js@0.8.5 and the problem disappeared. Run the following command in your project folder:
npm install zone.js@0.8.5 --save
这篇关于Angular 2-TypeError:无法读取未定义的属性"apply"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!