say example, have 4 users email addresses:
hello@world.com hi@world.com yo@world.com yeah@world.com this search query view
$scope.searchquery = "h"; i run query allows me list of user email address start letter "h".
usersref.orderbychild('email').startat($scope.searchquery).endat($scope.searchquery+"~").on('value', function(snapshot){ console.log(snapshot.val()); } so, results in here are:
hello@world.com hi@world.com however, i'd searchquery match whole string, not start letters. expected results in case ($searchquery = "h"):
hello@world.com hi@world.com yeah@world.com i've tried this:
usersref.orderbychild('email').startat($scope.searchquery).endat("~"+$scope.searchquery+"~").on('value', function(snapshot){ console.log(snapshot.val()); } the results includes 4 email addresses.
then, i've tried this:
usersref.orderbychild('email').startat("~"+$scope.searchquery).endat($scope.searchquery+"~").on('value', function(snapshot){ console.log(snapshot.val()); } the result null.
can me figure out please.
any answer appreciated.
thanks
Comments
Post a Comment