loopback-example-angular-live-set icon indicating copy to clipboard operation
loopback-example-angular-live-set copied to clipboard

$watch function can't catch changes ?????

Open ghost opened this issue 10 years ago • 3 comments

Hi,

in the angular-liveset-example https://github.com/strongloop/angular-live-set-example I add $watch function to see the changes in the Live Set object "colors", however, $watch function not catching any changes !!!

any idea how to catch changes ?

Please help me

$scope.$watch('colors', function(newValue, oldValue) {
    console.log('update set')); 

ghost avatar Jan 20 '16 07:01 ghost

Does this work for you?

changes.on('data', function(update) {
  data.forEach(function(points) {
    if($scope.paused) return;
    points.values.push([
      update.time,
      update.usage[points.src]
    ]);

    while(points.values.length > MAX && points.values.length > 1) {
      points.values.shift();
    }

    points.values = angular.copy(points.values);
  });

  $scope.$apply();
});

https://github.com/strongloop/loopback-example-angular-live-set/blob/master/client/modules/chart/chart.controller.js#L36

0candy avatar Feb 24 '16 19:02 0candy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 23 '17 14:08 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 06 '17 14:09 stale[bot]