title: $q function is not returning any values
body: <p>When I run this code I am expecting to receive a list of names that I can use in my html. It looks like my function is simply not returning anything and I can't figure out why. I need a few pointers on the proper syntax for using $q on functions that aren't a part of the controller function.</p>
  
  <pre><code>function playerNames($q) {
  
  Parse.$ = jQuery;
  
  Parse.initialize("mykey", "mykey");
  
  var namesdfd = $q.defer();
  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");
              names.push(name);
          }
          namesdfd.resolve(names);
      },
      error: function (error) {
          namesdfd.reject(data);
      }
  });
  return namesdfd.promise
      .then(function (results) {
          alert("Results.." + results[1]);
          return results;
      })
      .catch(function (error) {
          alert(error.message);
      });
  };
  
  app.controller('NameController', ['$scope', '$q', function($scope, $q) {$scope.names = playerNames($q)}]);
  </code></pre>