I want to set the value of table cell to the address returned by the geocode api.
{{addr}}
the controller method written by me is as follows.
this.getAddress = function(lat,lng) {
console.log('x.lat ' + lat + ' x.lng ' + lng);
var p = new Promise(function(resolve,reject){
var address;
var geocoder = new google.maps.Geocoder;
geocoder.geocode({'location': {lat: parseFloat(lat), lng: parseFloat(lng)}}, function(results, status) {
if (status === 'OK') {
if (results[0]) {
resolve(results[0].formatted_address);
} else {
resolve('No results found');
}
} else {
reject('Geocoder failed due to: ' + status);
}
});
}).then(function(v){
console.log('Resolved - Geo coder address ' + v);
$scope.addr = v;
}).catch(function(v){
console.log('Catch - Geo coder address ' + v);
});
};
But the value of addr is not getting changed though i am getting the address information in the controller method.