How do I pass an incremental value into the $http.get function. See below for code snippet:
for($scope.index=0 ; $scope.index < 5 ; $scope.index++)
{
$http.get('/api/post', {params: { id: $scope.userActivity[$scope.index].post }})
.success(function(res){
console.log('The value for index is: ' + $scope.userActivity[$scope.index]);
})
.error(function(data, status){
console.log(data);
});
}
})
I am getting "The value for index is: undefined" and it is driving me nuts!
Thanks