Skip to content

Commit

Permalink
Manually apply an angularjs digest cycle when invitations_worker retu…
Browse files Browse the repository at this point in the history
…rns.

It seems web workers are outside the digest cycle and a digest must be manually invoked in the worker callback. Otherwise changes in the model (e.g. flags that make alerts temporarily visible) may not be reflected in the view (the alert may not become visible despite the flag becoming true).
  • Loading branch information
amatriain committed Nov 22, 2016
1 parent 33158ba commit 7d37812
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -3,8 +3,8 @@
########################################################

angular.module('feedbunch').service 'invitationsSvc',
['csrfTokenSvc', 'timerFlagSvc',
(csrfTokenSvc, timerFlagSvc)->
['csrfTokenSvc', 'timerFlagSvc', '$rootScope',
(csrfTokenSvc, timerFlagSvc, $rootScope)->

# CSRF token for POST
token = csrfTokenSvc.get_token()
Expand All @@ -26,6 +26,7 @@ angular.module('feedbunch').service 'invitationsSvc',
timerFlagSvc.start 'no_invitations_left'
else
timerFlagSvc.start 'error_sending_invitation'
$rootScope.$digest()

service =

Expand Down

0 comments on commit 7d37812

Please sign in to comment.