Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$geolocation.position.coords???? #31

Open
kintela opened this issue Sep 21, 2016 · 2 comments
Open

$geolocation.position.coords???? #31

kintela opened this issue Sep 21, 2016 · 2 comments

Comments

@kintela
Copy link

kintela commented Sep 21, 2016

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

@WildWeazel
Copy link

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.

@Tazaf
Copy link

Tazaf commented Apr 18, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants