@dedevedder wrote:
Hi guys, I’m trying to pass the geolocation coordinates from my Ionic 3 App to my Rails 5 API but I don’t know how I can’t get data this way:
I tried to create variables this way:
public lat: number;
public lng: number;this.geo.getCurrentPosition().then((resp) => {
alert(resp.coords.latitude); //here I can see the coordinate in alert alert(resp.coords.longitude); //here I also receive the coordinate in alert this.lat = resp.coords.latitude; //my variable receive the data here this.lng = resp.coords.longitude; //my variable receive the data here
}).catch((error) => {
console.log(‘Ocorreu um erro’, error);
});BUT HERE I CAN`T USE THE COORDINATES TO BE SENT TO API:
let dados_app = JSON.stringify({
latitude: this…lat, //nothing here
longitude: this.lng, //nothing here
});Do you know if have some special variable to get this data from this plugin?
Thanks for advance guys.
Posts: 3
Participants: 2