title: Angular.js not displaying array of objects retrieved from $http.get
body: <p>I am new to angular.js and I am trying to understand how to use the $http functions like <code>$http.get</code> and <code>$http.post</code>.</p>
  
  <p>I have a very simple app retrieving messages from a MySQL database through a Java rest service. The data returned looks like:</p>
  
  <pre><code>[
    {id:1, content:"Hello World!"}, 
    {id:2, content:"Testing 1, 2, 3..."}, 
    {id:3, content:"I am from the database"}
  ]
  </code></pre>
  
  <p>I am attempting to list them using ng-repeat like so:</p>
  
  <pre><code>&lt;div ng-controller="MessageController"&gt;
    &lt;ul&gt;
      &lt;li ng-repeat="m in messages"&gt;{{m.content}}&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And then my controller looks like so:</p>
  
  <pre><code>function MessageController($scope, $http) {
    $scope.getAll = function(callback) {
      $http.get('/messages').success(function(response) { callback(response); });
    }
  
    $scope.messages = $scope.getAll(function(data) { return JSON.stringify(data); });
  }
  </code></pre>
  
  <p>I see the call is properly returning an array of message objects and I can print them to the console from within the callback function but for some reason they are not being displayed in the <code>ng-repeat</code>. I was able to get this to work when I was manually creating a list of messages, but when I introduced the <code>$http.get</code> piece, it stopped working.</p>
  
  <p>Am I missing something?</p>
  
  <p><strong>EDIT:</strong> I am using angular.js version 1.2.19</p>