No, you're right. I posted too quick. I'm calling from this.platform.ready also. Had to take a second look. And actually, I'm running my this.geolocation.getCurrentPosition()
like so:userCoordinates: object;
constructor (public geolocation: Geolocation) {
this.userCoordinates = {};
this.userCoordinates['latitude'];
this.userCoordinates['longitude'];
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.geolocation.getCurrentPosition().then((position => {
this.userCoordinates['latitude'] = position.coords.latitude;
this.userCoordinates['longitude'] = position.coords.longitude;
})
.catch((error) => {
console.warn(error);
})
}
}
Sorry for no indentation in my example. No idea why it wont indent. It looks like i'm doing a couple/few things I shouldn't be doing (like running the function from my constructor?), but it works. maybe initializing the userCoordinates object ahead of time is helping on my end?