I have to improve my code with reverse geocoding. Now my app get the position by device's GPS.
This is my controller:
.controller('MapCtrl', function($scope, $ionicLoading, $compile) {
function initialise() {
function onSuccess(position){
var myLatlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var mapOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
}
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
});
$scope.map = map;
}
function onError(error){
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
google.maps.event.addDomListener(window, 'load', initialise);
});
I found in this link a solution, but I'm not be able to integrate it with my code.
Anyone can help me?