firebase - Geofire query doesn't activate unless ctrl + f5 -


i using geofire library angularjs. noticed odd happening when writing out basic geolocation based query. upon state change, page displays blank , query doesn't appear execute. however, if ctrl + f5, data displays , query executes.

i wondering why happening. i've included controller code below. appreciated, i've been trying numerous things (tried updating user's geolocation force event triggered, $timeout, etc).

'use strict';  angular     .module('m02-discover')     .controller('discovercontroller', [         '$scope', '$state', 'fbref', 'fbgeo', '$geofire', 'discover', '$timeout',         function($scope, $state, fbref, fbgeo, $geofire, discover, $timeout) {            var ref = new firebase(fbref);           var georef = new firebase(fbref + 'geofire/');           var $geo = $geofire(georef);            $scope.searchresults = [];            var query = $geo.$query({               center: [37.68465, -122.1420265],               radius: 10           });            // setup angular broadcast event when object enters our query           var geoquerycallback = query.on('key_entered', 'search:key_entered');            // listen angular broadcast           $scope.$on('search:key_entered', function (event, key, location, distance) {              // interesting object             ref.child('users').child(key).once("value", function(snapshot) {               var user = snapshot.val();               $scope.$apply(function(){                 $scope.searchresults.push(user);               });             });              // cancel query if distance > 50 km             if(distance > 50) {               geoquerycallback.cancel();             }            });            $scope.favoriteuser = function(favoritedid, favoritedtwitterid){             discover.favoriteuser(favoritedid, favoritedtwitterid);           }          } ]); 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -