I ran into a similar problem using the angular-leaflet-directive<https://github.com/tombatossals/angular-leaflet-directive>module (which it looks like you might be using as well?). While I haven't had a chance to drill down into the source yet, it looks like the problem is being caused by a watcher on the map location which becomes overwhelmed (that is to say, too many digest cycles triggered) by the leaflet animation when the map position is changed programatically.
disabling the animation solves the problem (although it is not ideal that this needs to be the solution). I haven't found a way to disable animation as a master setting yet, but I was able to solve the problem for each particular center change event by accessing the map object directly and using leaflet's built in .panTo() function like so: leafletData.getMap().then(function(map) { map.panTo([new_lat, new_long], {animate:false}) }); here's<http://tombatossals.github.io/angular-leaflet-directive/examples/access-leaflet-object-example.html>an example of how to access the map object directly (hint: you'll need to import the leafletData module). hope this helps. P On Friday, April 11, 2014 3:01:39 AM UTC-4, Sylvain M. wrote: > > Hi, > > I'm having trouble with angularJS and geolocation API (cordova app). > > > $scope.GEOsucces=function(position) > { > var newpos ={ "lat": position.coords.latitude, "lng": > position.coords.longitude, "altitude": position.coords.altitude }; > var newcenter={ "lat": position.coords.latitude, "lng": > position.coords.longitude, "zoom": 15 }; > $scope.$emit('NEW_GPS',newpos, newcenter); > > return false; > }; > > $scope.GEOerreur=function(err) > { > $log.info("GPS error..."); > return false; > }; > > $scope.$on("NEW_GPS", function(event, pos, centre) > { > $scope.$apply(function() > { > $scope.mytrace.path.p2.latlngs.push(pos); > $scope.mytrace.centre.lat = centre.lat; > $scope.mytrace.centre.lng = centre.lng; > }); > $log.info($scope.mytrace); > }); > > GeoLoc = navigator.geolocation.watchPosition($scope.GEOsucces, > $scope.GEOerreur, { maximumAge: 3000, timeout: 10000, enableHighAccuracy: > true}); > > It works for a while and then I get the following error : > > http://errors.angularjs.org/1.2.12/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3 > …406%2C%5C%22zoom%5C%22%3A13%2C%5C%22autoDiscover%5C%22%3Afalse%7D%22%5D%5D > at http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:7548:12 > at Scope.$digest ( > http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:19339:19) > at Scope.$apply ( > http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:19553:24) > at safeApply ( > http://127.0.0.1:1200/bower_components/angular-leaflet-directive/dist/angular-leaflet-directive.min.js:32:11561 > ) > at Object.<anonymous> ( > http://127.0.0.1:1200/bower_components/angular-leaflet-directive/dist/angular-leaflet-directive.min.js:31:21383 > ) > at o.Mixin.Events.fireEvent ( > http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:6:5055) > at o.Map.Keyboard.o.Handler.extend._onBlur ( > http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:9:8418) > at HTMLDivElement.t.(anonymous function).s [as _leaflet_blur13] ( > http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:8:20284) > ionic.bundle.js:16905 > Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. > Aborting! > Watchers fired in the last 5 iterations: [["fn: parentValueWatch; newVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}; > > oldV...<omitted>...5D ionic.bundle.js:7548 > Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! > Watchers fired in the last 5 iterations: [["fn: parentValueWatch; newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center; > > newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"],["fn: > > parentValueWatch; newVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}","center; > > newVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}"],["fn: > > parentValueWatch; newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center; > > newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"],["fn: > > parentValueWatch; newVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}","center; > > newVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}"],["fn: > > parentValueWatch; newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center; > > newVal: > {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}; > > oldVal: > {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"]] > > Any help welcome... > > Best regards, > > Sylvain > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.