Having trouble updating a variable in the ng-repeat loop
<div ng-controller="MapViewCtrl">
<a class="item item-avatar" ng-href="#/event/tabs/mapView" >
<img src="img/location.jpg"/>
<span class="input-label">Locations Of event</span>
<div ng-repeat="item in positions" style="font-size: 12">{{item.address}}</div>
</a>
</div>
Code snippet from controller:
$scope.closePage = function() {
for (var i = 0; i < markers.length; i++) {
var lng = markers[i].position.A;
var lat = markers[i].position.k;
var address = "";
var latlng = new google.maps.LatLng(lat, lng);
$scope.$apply( $scope.geocoder.geocode({'latLng': latlng},function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
address = results[0].formatted_address;
var location ={
address: address
}
$scope.positions.push(location);
}
}
}));
}
$state.go('eventmenu.createevent');
};
Looking for suggestions on how to update the 'positions' variable properly.