ngGeolocation icon indicating copy to clipboard operation
ngGeolocation copied to clipboard

$geolocation.position.coords????

Open kintela opened this issue 8 years ago • 2 comments

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

kintela avatar Sep 21 '16 07:09 kintela

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.

WildWeazel avatar Dec 20 '16 18:12 WildWeazel

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.

Tazaf avatar Apr 18 '17 16:04 Tazaf