From ef9f7f7830d2521a75791526bc879521de9de40b 2016-10-04 16:57:36 From: Marcin Lulek Date: 2016-10-04 16:57:36 Subject: [PATCH] channelstream: use $scope.$apply --- diff --git a/frontend/src/components/channelstream.js b/frontend/src/components/channelstream.js index 35ab0cc..33885a6 100644 --- a/frontend/src/components/channelstream.js +++ b/frontend/src/components/channelstream.js @@ -38,15 +38,17 @@ function ChannelstreamController($rootScope, stateHolder, userSelfPropertyResour }; stateHolder.websocket.onmessage = function (event) { var data = JSON.parse(event.data); - _.each(data, function (message) { - console.log('channelstream-message', message); - if(typeof message.message.topic !== 'undefined'){ - $rootScope.$broadcast( - 'channelstream-message.'+message.message.topic, message); - } - else{ - $rootScope.$broadcast('channelstream-message', message); - } + $scope.$apply(function (scope) { + _.each(data, function (message) { + console.log('channelstream-message', message); + if(typeof message.message.topic !== 'undefined'){ + $rootScope.$broadcast( + 'channelstream-message.'+message.message.topic, message); + } + else{ + $rootScope.$broadcast('channelstream-message', message); + } + }); }); }; stateHolder.websocket.onclose = function (event) {