This is the outline of a function to perform and http post request to get all the entries from a table. This function is defined within my controller.
$scope.getAllData = function (tableName) {
var allDataResults = $resource('/getAllDataForTable', {}, {
save: {
method: 'POST',
timeout: 6000
}
});
allDataResults.save($scope.all_data_input, function (response) {
//Do stuff with response
}
});
};
I need to call this function sequentially for different tablenames. I tried simply calling it twice like this.
$scope.getAllData(tableName1);
$scope.getAllData(tableName2);
The second response comes in correct, but the first one is incorrect. Each response contains a list and the size of the second response's list is forced on the first one, causing the response to be incorrect. How do I properly chain these 2 post requests requests?