Angular 2.3/Zone.js 0.7.2:某些组件损坏 [英] Angular 2.3 / Zone.js 0.7.2: Some components broken

查看:33
本文介绍了Angular 2.3/Zone.js 0.7.2:某些组件损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Angular 2.2.4的应用程序,zone.js版本在 package.json 中定义为 ^ 0.6.25 .我尝试更新到Angular 2.3和 zone.js ^ 0.7.2 ,发现某些组件出现异常消息未处理的承诺拒绝:TypeError:无法设置属性'名称未定义".令人惊讶的是,损坏的组件与仍可以正常工作的其他组件没有太大不同-它们使用单​​独文件中的模板,通过Rx.js使用API​​服务等,但是显然,这些组件可重复出现故障必定有某些原因.

I have an application using Angular 2.2.4, with zone.js version defined as ^0.6.25 in package.json. I tried to update to Angular 2.3 and zone.js ^0.7.2, and found that some components broke with exception message "Unhandled Promise rejection: TypeError: Cannot set property 'name' of undefined". Surprisingly, the broken components do not very different things than other components that still do work – they use templates in separate files, use an API service via Rx.js etc., but obviously, there must be some reason why these components fail reproducably.

关于SO的另一个问题指出,该问题可能与所使用的zone.js版本有关,因此我将其降级了到之前的0.6.25,发现一切正常(或者至少是e2e测试涵盖的所有内容,这是大多数应用程序).

Another question on SO pointed out that the problem might be related to the zone.js version used, so I downgraded to the previous 0.6.25 and found that everything works flawlessly (or rather least everything which is covered by e2e tests, which is most of the application).

是否有解决问题的提示?如果不是这样:坚持使用zone.js 0.6.x 还是安全的?或者早晚我会遇到Angular2的问题?

Any hints for solving the problem? If not: should it be safe to stick with the zone.js 0.6.x, or will I run into problems with Angular2 sooner or later?

推荐答案

虽然我没有找到问题的原因,但是我使用zone.js 0.7.4测试了Angular 2.4.1,并且效果很好.

While I did not find the cause of the problem, I tested Angular 2.4.1 with zone.js 0.7.4, and this worked perfectly.

这篇关于Angular 2.3/Zone.js 0.7.2:某些组件损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆