JustMaier/angular-signalr-hub

Scope $digest() not triggered after hub events fired

ProdigySim opened this issue · 0 comments

In order for angular to update our UI magically, we need $rootScope.$digest() to occur after any of our app code is executed. When angular-signalr-hub receives an incoming event from the hub, it does not trigger a digest afterwards--so any data changes we make in our event listeners will not be automatically picked up by angular.

This can be solved by either manually calling $rootScope.$apply() or $rootScope.$digest() after running the user's event callbacks (à la $TimeoutProvider) or by simply wrapping the callbacks in a $timeout() call (See: angular-socket-io).