jeudi 29 janvier 2015

An array of objects can not be seen in the method. (angularjs)


Sorry for my english.



chill.controller('messagesController', function($scope, $http, $rootScope, $location, $stateParams, $ionicSlideBoxDelegate, $ionicLoading) {

if ($rootScope.userData != undefined) {
$ionicLoading.show({
template: 'loading'
})
$http.get('http://ift.tt/1HlXCMj'+$rootScope.userData.id_user+'/id_contact/'+$stateParams.id)
.success(function(data) {
$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://ift.tt/WJEHSa'+lat1+','+lat2+'&sensor=false')
.success(function(data) {
$ionicLoading.hide();
$scope.messages.response[i].address = data.results[0].formatted_address;
});
};
};
$ionicSlideBoxDelegate.update();
});
}
else
{
$location.path('/login');
};


});


An array of objects $scope.messages.response[i].address not visible(undefined) in success(function(data){}.


Help me, please.





Aucun commentaire:

Enregistrer un commentaire