Hi,
I’m new bee to firebase, I have problem dynamically adding items to ng-repeat list, my code is:
db = firebase.database();
var firebaseRef = db.ref('/');
var geoFire = new GeoFire(firebaseRef);
var ref = geoFire.ref(); // ref === firebaseRef
var geoQuery = geoFire.query({
center: [41.996739, 21.423780],
radius: 2000
});
$scope.requests = [];
geoQuery.on("key_entered", function(key) ){
alert(key);
firebaseRef.child(key).once("value")
.then(function(snapshot) {
// ... and add it to the matches array
$scope.requests.push(snapshot.val());
})
});
I put alert for debugging and when key enters location radius alert is firing, but my list is not automatically updated, if I refresh view on my app, than I can see my item updated. If I remove geofire and use $firebaseArray to get items, they are updating my list automatically on every change, new item or removed item.
I also tried to implement $firebaseArray with geofire, but always I got errors.
What I’m doing wrong here? or how can I Implement $firebaseArray with geofire.
I’m on firebase version 3.9, geofire 4.1.2, angularfire 2.3.0