Thanks for looking into this. Using $timeout certainly works in this case, that is good to know. I used setTimeout in this example, at other times I might have the same issue interacting with a 3rd party asynchronous operation that isn't wrapped in AngularJS. $scope.$apply seems to work in this case, but that feels awkward because presumably the digest of the $scope broadcasting the event will be done, rather than the $scope receiving the event. It does work in jsfiddle though, so that is good. I wonder if anyone can explain that?
On Sun, Mar 16, 2014 at 11:34 PM, Justin Walsh <[email protected]> wrote: > Hi Frank > > Strictly speaking, setTimeout is not an 'angular' function, so you would > either need to > > Inject the $timeout service and use that in preference > Call $scope.$apply as follows: > > $scope.submitFoo2 = function() { > setTimeout(function() { > $scope.$apply(function() { > $rootScope.$broadcast('fooChanged', ++nextValue); > }); > }, 0); > }; > > > Having said that, I am left wondering why it works second time around.... > > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/xaZcuKB7IlA/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
