$scope.sentPhoto = function(id_contact) {
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL
});
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = imageData;
var alertPopup = $ionicPopup.show({
title: '<h3>Photo sent!</h3>'
});
alertPopup.then(function(res) {
});
$timeout(function() {
alertPopup.close();
}, 800);
}
function onFail(message) {
alert('Failed because: ' + message);
}
};
Сделал как Вы казали. Но есть небольшой вопрос. Как добавить новое значение в объект?
$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)
{
$scope.mapAdd = data;
к $scope.messages.response[i] добавить значение$scope.mapAdd.results[0].formatted_address
});
};
};
$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)
{
$scope.mapAdd = data;
к $scope.messages.response[i] добавить значение$scope.mapAdd.results[0].formatted_address
});
};
};
<map style="height: 70vh" zoom="15" center="{{ messages.content }}" disable-default-u-i="true">
<marker
position="{{ messages.content }}"
title="I'm Chill"
animation="Animation.BOUNCE"
draggable="true"
visible="true">
</marker>
</map>