I upgraded my angularjs package to 1.6.3 and found out that the .success and .error functions got deprecated are removed. Now after using .then and .catch, only the .catch executes. I'm struggling to find out why the request fails this time around.
My initial working code was:
if ($scope.IsDinamicReport) {
$http({
method: "POST",
url: "/api/DynamicReport/Post?pageNumber=" + $scope.PageNum + "&orderbyColumn=" + $scope.orderByColumn + "&sortOrder=" + $scope.sortOrder
+ "&showNumberPagingStats=" + $scope.showNumberPagingStats,
contentType: "application/json",
data: $scope.report
}).success(function (result) {
angular.copy(result, $scope.dynamicReport);
if (!$scope.dynamicReport.Error) {
$scope.HideDynamicRepFunctions = false;
$scope.exportColumnSelected = $scope.dynamicReport.Columns[0]; //Set default for export drop down
//TABLE SIZING
var persentage = $scope.returnTableSizing(result.Columns.length);
$('[data-table=container]')
.css('margin-left', '25px')
.css('padding-right', '25px')
.css('width', persentage)
.css('max-width', persentage);
}
else
alert("Error occured while generating the report, please contact helpdesk.");
}).error(function (data) {
alert("An error occured while generating the report, please try again.");
});
}
and then I changed it to the following:
if ($scope.IsDinamicReport) {
$http({
method: "POST",
url: "/api/DynamicReport/Post?pageNumber=" + $scope.PageNum + "&orderbyColumn=" + $scope.orderByColumn + "&sortOrder=" + $scope.sortOrder
+ "&showNumberPagingStats=" + $scope.showNumberPagingStats,
contentType: "application/json",
data: $scope.report
}).then(function (result) {
angular.copy(result, $scope.dynamicReport);
if (!$scope.dynamicReport.Error) {
$scope.HideDynamicRepFunctions = false;
$scope.exportColumnSelected = $scope.dynamicReport.Columns[0]; //Set default for export drop down
//TABLE SIZING
var persentage = $scope.returnTableSizing(result.Columns.length);
$('[data-table=container]')
.css('margin-left', '25px')
.css('padding-right', '25px')
.css('width', persentage)
.css('max-width', persentage);
}
else
alert("Error occured while generating the report, please contact helpdesk.");
}).catch(function (data) {
alert("An error occured while generating the report, please try again.");
});
}
How do I go about debugging what went wrong if you cannot see the error here already? The only thing I changed there is just the deprecated functions