I am using Angular and I am trying to get the user's current location to show some shops that are near. When I get the user location, it always becomes wrong, it gives me another location. (e.g. I am living in city 1, it gives me a location in city 2 )
this is the code I am using:
if (window.navigator && window.navigator.geolocation) {
window.navigator.geolocation.getCurrentPosition(
position => {
this.geolocationPosition = position,
console.log(position)
this.userAltitude = +position.coords.latitude;
this.userLongtitude = +position.coords.longitude
}
)}