mikepugh / AngularGeoFire

Angular service wrapping the GeoFire geospatial lib for Firebase
MIT License
49 stars 7 forks source link

SEARCH:KEY_ENTERED does not work #12

Open firmanhidayat opened 8 years ago

firmanhidayat commented 8 years ago

// Setup Angular Broadcast event for when an object enters our query var geoQueryCallback = query.on("key_entered", "SEARCH:KEY_ENTERED");

// Listen for Angular Broadcast
$scope.$on("SEARCH:KEY_ENTERED", function (event, key, location, distance) {
    // Do something interesting with object
    $scope.searchResults.push({key: key, location: location, distance: distance});

    // Cancel the query if the distance is > 5 km
    if(distance > 5) {
        geoQueryCallback.cancel();
    }
});