$scope.messages = data;
for (var i = 0; i < $scope.messages.response.length; ++i) {
if ($scope.messages.response[i].type == 'location') {
var strings = $scope.messages.response[i].content.split(' ');
var lat1 = strings[0],
lat2 = strings[1];
$http.get('http://maps.googleapis.com/maps/api/geocode/json?latlng='+lat1+','+lat2+'&sensor=true_or_false')
.success(function(data)
{
$ionicLoading.hide();
$scope.mapAdd = data;
$scope.messages.response[i].formatted_address = $scope.mapAdd.results[0].formatted_address; вот здесь нужно добавить новое значение с ключом formatted_address, но если делать так, то TypeError: Cannot set property 'formatted_address' of undefined
console.log($scope.messages.response[i].formatted_address);
console.log($scope.mapAdd.results[0].formatted_address);
});
};
};
for(var i=0;i<MyObject.response.length;i++){
MyObject.response[i]['formatted_address ']= $scope.mapAdd.results[0].formatted_address;
}