ngGeolocation
ngGeolocation copied to clipboard
$geolocation.position.coords????
Hi I'm trying to use the example code $geolocation.watchPosition({ timeout: 6000, maximumAge: 250, enableHighAccuracy: true }); $scope.myPosition = $geolocation.position; console.log($scope.myPosition.coords);
But the $scope.myPosition have not the coords property.
Any idea?
Regards
I found that I had to call $geolocation.getCurrentPosition(), even if I don't store use result, before the object position
would be initialized. That seems to be a bug.
It's not a "bug", per se.
watchPosition()
being an asynchronous operation, you can't access the $geolocation.position
object right after calling the method (because it's result hasn't been returned yet).
It would have been nice to have some sort of callback or event fired when watchPosition()
first get the position, though...
EDIT : My bad... it's the case. See #3.