Within a ng-repeat list i call a function {{ getDetailedData(id) }} to enrich the repeat items with more data. Within this function I call perform a-synchronous $http call in order to get more data. This results in recursive behaviour: the a-sync function gets called infinte.
when I remove the a-sync call the function gets called only as mauch as there are items in the list is the source for the repeat.
The a-sync call has a decent callback and surely doesn't call the originating function.
Need your thoughts on this.
EDIT
function in controller:
$scope.getExtraData = function (id) {
sFact.getSpotDetail(id, function (data) {
console.log('getSpotDetail', data);
})
return false;
}
ng-repeat in partial:
<div class="col-lg-4" style="display: block;" data-ng-repeat="cust in spots | filter: query">
<h2 title="{{ cust.title }}">{{ $index + 1 }} {{ cust.title }}</h2>
{{ getExtraData(cust.id) }}
</div>
a-sync function sFact(ory)
factory.getSpotDetail = function(id, callback) {
var data = 'id=' + id;
$http({
url: "php/get_venue.php",
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
data: data,
method: "POST"
}).success(callback);
}
- {{getDetailedData(item.id)}}
` – jpmorin Oct 11 '13 at 15:12