I've been trying to handle properly in my angular service an explicit synchronization with Firebase. I use angularFireCollection with initial load callback function (I need to preload additional data basing on the data returned by the first query). However, I don't know how should I access the fetched data in the callback function:
getGroupIds: function() {
var deferred = $q.defer();
var ref = new Firebase('https://<XXX>.firebaseio.com/groups');
angularFireCollection(ref, function(groups) {
console.log(groups);
deferred.resolve(groups);
});
return deferred.promise;
}
In the above example, how can I access actual data from groups object?d Thanks in advance for any tips.
yourService.getGroupIds().then(function(groups) { });