AngularGeoFire icon indicating copy to clipboard operation
AngularGeoFire copied to clipboard

SEARCH:KEY_ENTERED does not work

Open firmanhidayat opened this issue 9 years ago • 0 comments

// 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();
    }
});

firmanhidayat avatar Feb 06 '16 12:02 firmanhidayat