Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs error on $$broadcast

Tags:

angularjs

I have an angular script, which broadcasts an event on the $rootScope (using $$broadcast). The version of angular I'm using is 1.1.4

On some occassions , this throws an exception inside the angular code:

Uncaught TypeError: cannot read property '$$nextSibling' of null.

Does any one has a clue what might be causing this error ? Unfortunately the code in which this error occurs is to big to post, but maybe someone could point me in the right direction?

The angular code where it happens is :

   // 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)) {

on the while statement

update: the broadcast is excuted from inside a clicked event on an external component the click event is an property of a config object for the external component.

like image 711
rekna Avatar asked Apr 11 '13 17:04

rekna


Video Answer


1 Answers

$timeout(function(){
    //do stuff
});

$timeout without a wait time works as well.

like image 115
m.e.conroy Avatar answered Oct 12 '22 22:10

m.e.conroy