My controller successfully retrieves and pushes an object onto an array using Parse:
var mySite = angular.module('mySite', []);
mySite.controller('listConnectors', ['$scope',
function ($scope) {
//Parse.initialize here;
$scope.array = [];
var TestObject = Parse.Object.extend("TestObject");
var query = new Parse.Query(TestObject);
query.find({
success: function (results) {
alert("Successfully retrieved " + results.length + " rows.");
// Do something with the returned Parse.Object values
for (var i = 0; i < results.length; i++) {
var object = results[i];
alert(object.id + ' - ' + object.get('foo') + " " + object.get('num'));
/***** Pushing onto array here *******/
$scope.array.push(object);
}
console.log($scope.array[0].attributes.foo); //Grabbed what was needed
},
error: function (error) {
alert("Error: " + error.code + " " + error.message);
}
});
}]);
I'm having trouble looping and listing the "foo" value of every object in the array, as shown by the console.log above. Nothing is being outputted. It seems like the ng-repeat might not be executing or entering:
<li ng-repeat="eachElement in array">
<a > {{eachElement.attributes.foo}}</a>
</li>
If you have any suggestions, I would appreciate it. Thanks!