javascript - Watch not being called on array push -


i have service peerjs contains array of active streams. when setting webrtc stream there callback called when stream becomes available

call.on('stream', function(stream){     activestreams.push(url.createobjecturl(stream));   }); 

when stream available push onto activestreams array. watch array value in controller this:

//peerrtc service , .getactivestreams returns activestreams array $scope.$watch(peerrtc.getactivestreams, function(activestreams) {   $scope.activestreams = activestreams; }, true); 

but reason watch callback doesn't execute when push url(string) value array.

am overlooking something? because activestreams value changing in callback function?

some condition, async call, need call $scope.apply() make work. try call right after push new data array.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -