我有一个角度脚本,它在$rootScope上广播一个事件(使用$$广播).
我正在使用的角度版本是1.1.4
我正在使用的角度版本是1.1.4
在某些情况下,这会在角度代码中引发异常:
未捕获的TypeError:无法读取null的属性’$$nextSibling’.
有没有人知道可能导致此错误的原因是什么?不幸的是,发生此错误的代码很重要,但也许有人可能指出我正确的方向?
角度代码发生的地方是:
// Insanity Warning: scope depth-first traversal // yes,this code is a bit crazy,but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $digest if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(current !== target && !(next = current.$$nextSibling)) {
在while语句中
更新:广播是从外部组件上的单击事件内部执行的
click事件是外部组件的配置对象的属性.
解决方法
$timeout(function(){ //do stuff });
没有等待时间的$timeout也可以.