AngularJS ngRepeat update model

Viewed 22056

I use ng-repeat to render a html table. My controller looks like so:

app.controller("fooCtrl", function($scope, WebSocket) {
  $scope.foo = [ ... ];

  WebSocket.start(function(data) {
    // this is a callback on websocket.onmessage
    // here is a for loop iterating through $scope.foo objects and updating them
  });
});

As you can see, I am updating the $scope.foo array periodically. However, my view is constructed like so:

<tr ng-repeat="item in foo">
  ...
</tr>

The problem is, when I update foo, it doesn't re-render my table with new data.

How would I go about this problem?

3 Answers
Related