0
votes

I'm new to Ionic and I'm currently learning. I tried to implement Geolocation plugin in app.component.ts on platform.ready function and I get lat and lng, but how can I send lat and lng to home page to display current location on a map. Should I implement geolocation function in provider?

1

1 Answers

0
votes

you can use ionic providers .

ionic g provider map

then write the code which wrote in app.component.ts there. and implement a getfunction like

getLatLng(){
return {lat:this.lat,lng:this.lng}
}

then import the provider into your home page and call the getLatLng() method.

Please research about ionic services/providers and Promises and observables. you can use these handy