Following is the code, which is consoling the response but unable to set the response to store in $scope.dateWiseData array. Let me know what I am doing wrong.
$scope.dateWiseData = [];
var tmpArr = [];
var x = 0;
for (var i=0; i< 7;i++) {
$http.post('/api/getdata', {_id: currentUser._id, data: data}).then(function(response){
console.log(response.data);
tmpArr.push(response);
if ( x < 7 ) {
$scope.dateWiseData = tmpArr;
}
x++;
});
}
console.log("--Week Data Array--");
console.log($scope.dateWiseData);