title: No data coming through when passing an array to an AngularJS controller using a function
body: <p>I am working on an angularjs application which uses parse to create an array of names. I then pass that array to a controller, which I use in my html. My problem is that no data is coming through and I'm not sure why. I have tested my Parse connection, and it is working correctly, and I test my controller and it is passing data correctly. It is just when I combine the two that it stops working.</p>
  
  <p>parse.js</p>
  
  <pre><code>function playerNames() {
  
  Parse.$ = jQuery;
  
  Parse.initialize("my key", "my key");
  
  var names = new Array();
  var GameScore = Parse.Object.extend("GameScore");
  var query = new Parse.Query(GameScore);
  query.find({
      success: function (results) {
          for (var i in results){
              var name = results[i].get("playerName");
              alert(name);
              names.push(name);
          }
          return names;
      },
      error: function (error) {
          alert(error.message);
          return names;
      }});
  };  
  app.controller('NameController', ['$scope', function($scope) {$scope.names = playerNames()}]);
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;div class="main" ng-controller="NameController"&gt;
  &lt;div class="container"&gt;
      &lt;table class="table table-hover"&gt;
          &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
          &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
          &lt;tr ng-repeat="n in names"&gt;
              &lt;td&gt;{{ n }}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>