parse.com - No data coming through when passing an array to an AngularJS controller using a function -


i working on angularjs application uses parse create array of names. pass array controller, use in html. problem no data coming through , i'm not sure why. have tested parse connection, , working correctly, , test controller , passing data correctly. when combine 2 stops working.

parse.js

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) {         (var 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()}]); 

index.html

<div class="main" ng-controller="namecontroller"> <div class="container">     <table class="table table-hover">         <thead>         <tr>             <th>name</th>         </tr>         </thead>         <tbody>         <tr ng-repeat="n in names">             <td>{{ n }}</td>         </tr>         </tbody>     </table> </div> </div> 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -